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,367,735
Community Members
 
Community Events
168
Community Groups

In clause in Query

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?

1 comment

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?

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.

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

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 

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?

Comment

Log in or Sign up to comment
TAGS

Atlassian Community Events