Hey All,
@Radek Dostál in the below link shared a way to use quotations 4 levels deep.. If I follow his hierarchy it works and if I change the order it does not... so seems like this is some rule...but in my case, in one of the inner clauses, I need to search for free text and that needs its own quotations.. so wondering if there is any clear documentation for this..
Hello Bizz,
Nested issueFunction
queries in JQL (Jira Query Language) can indeed become complex, especially when dealing with multiple levels of quotation marks. The key to managing this complexity is understanding how Jira processes these quotation marks at different nesting levels.
The hierarchy shared by Radek Dostál in the Atlassian Community post you referenced suggests a pattern for escaping quotations at each level to ensure that the query is parsed correctly. Here’s a quick breakdown:
'
\'
"
\\\'
When you need to include a free-text search within one of these nested clauses, it can get tricky, especially if the text itself contains quotation marks. The goal is to ensure that each level of nesting correctly escapes the quotations of its inner level.
Suppose you have a nested issueFunction
query where, at the second level, you need to search for a phrase like "Free Text"
.
'
\"Free Text\"
You would construct the query by embedding the inner query into the outer one, ensuring that you escape the quotation marks correctly at each level. Here’s a hypothetical example:
issueFunction in someFunction('...other criteria... AND issueFunction in anotherFunction(\"Free Text\")')
Start from the Innermost Part: Build your query from the inside out. Get the innermost query working first, then embed it into the next level.
Testing Incrementally: Test each level of nesting separately to ensure that it returns the expected results before combining them.
Escaping Characters: Pay special attention to escaping characters. In JQL, the backslash (\
) is used to escape quotes.
Consult Jira Documentation: For complex queries, refer to the Jira documentation or Atlassian Community for examples and guidelines.
Use a Text Editor: A text editor that highlights syntax can be helpful in visualizing the structure of your query and ensuring correct quotation usage.
Avoid Overcomplication: If a query becomes too complex, consider if it can be simplified or broken down into multiple simpler queries.
For specific syntax related to issueFunction
and ScriptRunner (if you’re using it), consult the relevant documentation or community forums. ScriptRunner’s documentation often provides examples of complex JQL functions, which can be very helpful in understanding the syntax.
Remember, the key is ensuring that each level of nesting correctly interprets its inner query, which is achieved by proper use of escape characters for quotations.
Awesome, thank you @Pablo Brincat for the detailed answer. Yes, I usually break inner ones into its own filter but was curious if I had to do it, how to properly escape and this info by you helps a lot with planning for future!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.