Encoded query strings

clintonm
Kilo Explorer

How do I put brackets in encoded query strings (for ui reference fields, in this case)?

 

I want to distinguish "(A and B) or C" from "A and (B or C)" so I put brackets in but they seem to be ignored.

4 REPLIES 4

Ashok10
Mega Expert

Clinton.



First thing is ,to form a Encoded query you can apply the filter what ever you need in list layout and once you applied your filter get the query by clicking on copy query as below



find_real_file.png



Also I don't think so that you need to put bracket.


If you see in the above screen shot I have applied query like (Active=true&&Priority=High)ORcategory=inquiry/help



then when you click on 'copy query' query looks like


active=true^priority=2^NQcategory=inquiry




Hope this helps.


snobypaul
Kilo Explorer

Hi, simply use below:


gr.addQuery('incident_state=1^active=true^NQincident_state=4');



I was trying to get all ("New" and "Active") incidents OR all ("Closed") incidents.


Kalaiarasan Pus
Giga Sage

if you learn difference between 'OR' condition beside 'Save' button and the normal 'OR' condition beside query , your problem is solved...



The 'OR' condition on top (beside 'Save') is a whole 'OR' condition for the all the query's added.. the 'OR' condition beside the query , will add 'OR' query for the current query..



Hope this helps


But using the top-level OR will effectively put an ^NQ in your query and you'll run into the problem described in KB0564887 - Using operator (^NQ) in encoded queries causes incorrect reference links in the list vie.... @inderpal found a brilliant way around this - see the community post Encoded Query & Add Or Condition query. (Neither the KB nor the community post existed back when this original post was written.)