JQL for comparing 2 string fields

Orit Nachshon
Contributor
January 30, 2018

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
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 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
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.
January 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
Vijay
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 21, 2019

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}$

3 votes
Hubbitus
Contributor
April 12, 2022

You may use Adaptivists ScriptRunner expression like:

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

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events