I have a Script Field called Value returning an integer representing the business value of a feature (the field is calculated based on other fields using Groovy). Its template is Number Field, the return type is int.
Unfortunately when using this field for sorting issues the order is lexicographic. What I need is to have proper integer comparisons and ordering.
Any idea about the possible cause?
The template just governs how it's displayed, not the sort. I'm afraid I have hard-coded it to compare as Strings.
To deal with this I need to give the user the option to "overload" that, but then you're moving away from a "simple scripted field" that is supposed to be easy to use for non-programmers into a nightmare of a UI with options for everything.
I may implement it like this: "if the user has provided an 'int compare'" method in their script, use that, otherwise use the default".
You could also try configuring it with the number searcher, but I don't think that's going to make any difference.
Thanks Jamie, here is the bug https://studio.plugins.atlassian.com/browse/GRV-178
Having this interpreted as an int would really be great. One of the other features I would like is to be able to filter my rapidboard based on that value, but of course I can only do it if it is correctly interpreted.
As a workaround for sorting:
if (val("Customer priority") == "[Yes]") result = 100; else result = 5 *(getValue("Demo value") + ...); return result.toString().padLeft(3, '0')
Is this still a thing in 2017?
I have a number field template scripted Field in ScriptRunner 5.0.4. / JIRA 7.x for 'days since last update', and can't get it to sort properly :(
It would make solely numeric fields more or less useless if they cant be sorted properly or jql'ed by range?! For e.g. 71 is between 761 and 758.
Sadly I couldn't find any workaround for this. Am I missing some configuration or some other thing here? Or is this simply not possible at the moment because of hardcoded lexicographic sort?
I am not sure if you ever figured this out, but I just ran into this exact issue. I was having trouble getting my scripted fields to search by their numeric value. All you need to do is:
This should allow JIRA to sort the numbers based on their numeric values. It worked for me. See attached image.
Atlassian Summit is an excellent opportunity for in-person support, training, and networking.Learn more
Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in talking to 20 people planning t...
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
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs