Writing a JQL Query with special characters

David Young March 19, 2021

I am trying to write a query to look at all fixVersions with 2021.mm*, as I have anywhere between 1 and 3 fixVersions listed per month or varying descriptions, yet each starts with the year and month (YYYY.MM).  How can I write a query to pick up all text in that field that matches my criteria. 

 

I've tried:

  • 2021.03*
  • \\[2021.03\\]
  • "\\[2021.03\\]"

But every time I execute the search I get back an error "The value '\[2021.03.0\]' does not exist for the field 'fixVersion'." or something along those lines.

 

Any help to diagnose and come up with a solution would be appreciated.  Thanks for your help.

 

2 answers

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.
March 19, 2021

Hi @David Young 

Please take a look at this post describing what Atlassian implemented to support wildcard searches of version fields for Server version:

https://jira.atlassian.com/browse/JRASERVER-24152

Best regards,

Bill

David Young March 20, 2021

I have tried the search function as I have ScriptRunner on my JIRA Server instance.  However when I run the following query:

filter = 17213 AND Status changed to (Done, Released, Closed) AND fixVersion in versionMatch("2021.03*") ORDER BY fixVersion ASC

 I get 258 results when I should get only about 65 or so.  I looked at why I'm getting so many and I'm pulling in fixVersions 2021.01.01, 2021.1, 2021.01.2, 2021.02.1, and 2021.02.2, however, my query should only be pulling fixVersions that match 2021.03*.

 

Thoughts?  Suggestions?  Am I missing something?

 

According to the link provided, I should be using the following query:

filter = 17213 AND Status changed to (Done, Released, Closed) AND fixVersion in versionMatches("2021.03*") ORDER BY fixVersion ASC

However when I do, I get the following error message:

Unable to find JQL function 'versionMatches(2021.03*)'.

Not sure why JIRA Server Ticket  calls for that text when its written differently.  I still need help getting this query to run correctly.  Any help would be appreciated.

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.
March 22, 2021

Hi @David Young 

The ticket and notes I linked were for built-in JQL searches with Server version, not with ScriptRunner.  You may want to check ScriptRunner documentation for answers about the search issues you are noting:

https://docs.adaptavist.com/sr4js/latest

0 votes
David Young March 22, 2021

@Bill Sheboy,

 

Something I found that was interesting.  I updated my query this morning to test out what was happening, and came across a result that I wanted but I can't explain it.  In my previous iteration my query brought back results from all fixVersions from previous versions this year, e.g

filter = 17213 AND Status changed to (Done, Released, Closed) AND fixVersion in versionMatch("2021.03*") ORDER BY fixVersion ASC

brought results from versions dating back to 2021.01.1.  However, I changed the query to the following:

filter = 17213 AND Status changed to (Done, Released, Closed) AND fixVersion in versionMatch("2021.03.0*") ORDER BY fixVersion ASC

and it brought results only from 2021.03.  It seems that adding a character after the last digit changes the query completely.  I don't need to add the "0" at the end, just the period (.) also returns the same result (which is the results I would expect.

 

I'm curious to know why the results vary, but it seems to work correctly or at least bring back the results I am expecting to find.  Thoughts?  Ideas?

Suggest an answer

Log in or Sign up to answer