In clause in Query

Harshal Gaikwad September 5, 2022

When I am trying to use jql like below

createdDate >= "2022-08-01" and issuetype = "Bug" AND project in ("project1" , "Project2") AND "Change Type" = New

then I am getting below error.

Caused by: com.atlassian.jira.rest.client.api.RestClientException: [ErrorCollection{status=400, errors={}, errorMessages=[Error in the JQL Query: Expecting ')' before the end of the query.]}]

 

When I change jql to below :

createdDate >= "2022-08-01" and issuetype = "Bug" AND project in ("project1") AND "Change Type" = New 

or

createdDate >= "2022-08-01" and issuetype = "Bug" AND "Change Type" = New

it works fine.

So something in "IN" clause with spaces not working correctly for me. Could you please guide me how JQL should be provided in above case?

5 answers

0 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 7, 2022

From research I did yesterday it appears that you are using the Jira Java REST Client. Unfortunately I don't have any experience with that or Java.

I am suspicious of how the query string is getting assigned to the "jql" variable that is getting passed into the API call. The query string contains several characters that may need to be escaped to pass through correctly into a string variable in other languages. I'm not familiar with the string manipulation rules for Java.

Can you output the value of the "jql" variable to see if it matches what you expect?

Can you put the query string in to the API call rather than using the "jql" variable and see what the result is?

0 votes
Harshal Gaikwad September 7, 2022

it is loaded from external config file

jql=createdDate >= "2022-08-01" and issuetype = "Request Change" AND project in ("project1", "project2") AND "Change Type" = Evolutive 

0 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 7, 2022

Can you show us the code where you are assigning the text to the "jql" variable that you use in the above code?

0 votes
Harshal Gaikwad September 7, 2022

Dear @Trudy Claspill ,

Thanks a lot for your reply !!

I am using the JIRA api to access JIRA services. and Querying with below call.

 ==> jiraRestClient.getSearchClient().searchJql(jql, 1000, 0, null)

where jql is mentioned above.

and as soon as I claim the result I get above error.

0 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 6, 2022

Hello @Harshal Gaikwad 

Welcome to the community.

Are you using this filter in the UI or in the API? If you are using it in the API can you show us the code?

If you are using this in UI, do your actual project names have spaces in them? If they do not have spaces, you don't need to enclose them in quotes in a JQL in the UI.

Can you show us the actual text of the "project in ..." portion of the filter?

Suggest an answer

Log in or Sign up to answer