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,463,158
Community Members
 
Community Events
176
Community Groups

JQL for comparing 2 string fields

Hi,

I want to compare 2 fields in a simple JQL:

I want to find all issues in a project that the "Summary" field has the same text as "Acceptance Criteria" (custom field).

How can I do it without plugins?

Thanks!

2 answers

1 accepted

2 votes
Answer accepted
Thomas Deiler Community Leader Jan 30, 2018

Dear @Orit Nachshon,

unfortunately you cannot do this. JQL ist not SQL. It has not the ability to compare two fields. Only fields with values/functions can be compared.

So long

Thomas

miikhy Rising Star Jan 30, 2018

I definitely agree with Thomas.

There might be many ways using plugins or direct SQL or scripting but JQL is meant to search/filter so it's pretty basic, or at least not embedding calculation features.

Cheers

Like Jesse Kona likes this

use Adaptavist script runner function:

issueFieldMatch (subquery, fieldname, regexp)

Query on any field by regular expression. Performance will be roughly proportional to the number of issues selected by the subquery, so use the query that selects the smallest set of issues you can, eg just your projects. On my dev machine this function handles around 20k issues per second.

To find all issues where the description contains a ABC0000 where 0000 is any number, you could use:

issueFunction in issueFieldMatch("project = JRA", "description", "ABC\\d{4}")
 

Note - you need to double the backslashes. Note - the function searches for the reg exp anywhere within the field. To match the entirety of the field, use ^ and $, e.g. ^ABC\\d{4}$

You may use Adaptivists ScriptRunner expression like:

issueFunction in expression ("", "Summary != customfield_1234")

 

Suggest an answer

Log in or Sign up to answer