Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,560,381
Community Members
 
Community Events
185
Community Groups

JQL Searching of select list field that contain numerical values?

Edited

I have a field that we have created that is a single select drop down list. Within this list is a series of 12 numbers. I need to be able to search on this field using the ">=" or "<=" operators.

Is this possible? Any thoughts on how to do this?

1 answer

1 vote
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jul 19, 2021

Hi @Laci 

I do not think you can do that with out-of-the-box JQL.  You might be able to type-convert if you have scripting addons from the marketplace.  Or build something using automation rules.

A work-around would be to use a membership test.  For example...

  • If your single-select field contained: 0, 1, 3, 5, 23.7, 50, 1000
  • And you wanted to find >= 5
  • You might search with myField IN (5, 23.7, 50, 1000)

Best regards,
Bill

@Bill Sheboy , thanks. Unfortunately, that is not going to be attainable as our list of numbers is ever growing and changing. We need something that will allow us to use those search operators.

We do have Scriptrunner. I am just not familiar enough with scripting on how to write such a code.

Thanks!

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jul 19, 2021

Thanks for clarifying, Laci.  I'm on Cloud, without ScriptRunner, so I am unable to give you ideas on using that tool.

Hopefully another community member from Adaptavist can help.

Derek Fields
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jul 19, 2021

Using ScriptRunner, you can create a scripted numeric field. The script would simply be

getCustomFieldValue("<field name>").value

 This will give you a field that you can apply the ">" operator to.

Make sure that you set the Searcher to Number in the Custom Field configuration when you create the scripted field. You will also need to reindex so that the index has the values of the custom field.

Like # people like this

@Derek Fields unfortunately, this does not allow me to create a drop down menu and I don't trust my developers to input things in properly or consistently with just a text field.

 

I also keep getting an error with your code. It gives me a static error as well as just not being able to run it.

Derek Fields
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jul 28, 2021

@Laci - I think that you misunderstood my answer. Create your custom field as a drop-down list of values. Lets say that you call it "Points" - this would be the dropdown list that your users would select from.

Then create a scripted field using Scriptrunner and configure it with the script:

getCustomFieldValue("Points").value

This field doesn't have to be on any screen. You can use the value of this field in your JQL as part of a greater-than or less-than comparison. For instance, if you name this field "Scripted Points", then you can write JQL that includes

"ScriptedPoints" > 4

That should give you the best of both - a drop-down list for data entry and a number field for JQL

@Derek Fields Thanks! 

I did this, however it still doesn't give me the ">" or "<" operators. I can only use "~" and "!~".

:(

Derek Fields
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Aug 05, 2021

Check that the Renderer on the Script Field is set to Number and not text. That is probably why you aren't seeing the numeric operators. Remember that you are using the script field in your JQL, not the drop down list field.

Thank you! That worked... however, we have a couple option that have multiple decimal points within them so Jira doesn't like that and won't allow it to be searched that way.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events