I am using JIRA Cloud and I have a custom field on on my "Create" and "View" screens called "Cost", it is a Number Field.
I have removed the "Cost" field from the Edit screens for the issuetype. The reason for this is that I don't want users to edit the field later on in the workflow in order to skip some of the checks and balances that I have in place for the value in this field (certain approvals are required depending on cost).
So how do the users specify cost at all? Well, I associate a screen with transitions at the start of the workflow asking the user to specify a cost:
In the early part of the process, they can specify the cost if they know it. The cost may be up to several tens of millions. If they don't know the cost at that point they can leave it NULL for the time being, or put it to zero, I don't mind and I don't check the value as it passes through those early transitions. Leave it NULL, make it zero, make it 20,000,000 (commas included for readability only) I don't mind.
However, at a certain point in the workflow, I want to ensure that the value is not NULL and is greater than zero. The not NULL validation check is easy using a "Field Required" validator:
However, this does not check for the value zero, it is only checking for NOT NULL.
Remember, I want this transition to be possible (i.e. draggable on an Agile board), so I cannot use a Condition Validator that says "Cost > 0" - because if it's zero, then the transition is not even available - you will not be able to drag it to the next column on the board.
Therefore, I need a validator. As already shown, the "Field Required Validator" is only checking for a value, it does not check for numbers greater than zero.
The only option I see to perform this validation is the "Regular Expression Check" validator:
So I enabled this and gave it the following regular expression:
I tested this RegEx on a few online RegEx sites and it seems to do what I want, i.e. it won't allow zero, but will allow numbers above zero as well as values like 100.50, 100000.99 and such like.
However, when I put this Regular Expression into JIRA as a validator:
Everything appears to work fine until you reach larger values. When the cost is 9,999,999.99 (I put the commas in for readability only) it passes the validator.
However, as soon as the cost value reaches 10 million the validator fails with the following message:
Not only is the validator message GOD AWFUL and not changeable, why on earth is it failing when it reaches 10 million? The RegEx looks fine.
I assume JIRA is doing something stupid with the value internally, converting it to exponential format (1.0E7) when it reaches 10 million which is then causing the RegEx validator to fail.
How can I overcome this scenario? Any advice is much appreciated!
With numbers that large the code base appears to translate into Scientific notation. Try the following regex for scientific notation:
You can use this StackOverflow article for reference.
In regards to getting the message changed, I would go to JAC and create a Suggestion ticket.
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
...+ reading Fantasy). The same is true for him at the bank he works for: Efficiency is key when time literally equals money. Read on to learn how Sergey makes most of the time he has by...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG