Advanced query with addEncodedQuery and operator priority
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2012 06:08 AM
Hi,
I would like to script and adanced query, using addEncodedQuery.
What I what to do is a query like this :
A and B and (E or D or (F and G)), with A, B, C, D, E, F and G as conditions.
But I don't know how to implement parenthesis using addEncodedQuery (I tryed to add parenthesis but it broke my query).
Here is a sample of what I do, but it seems that the case " or (F and G)" is not working :
u_status=Validated^sys_id!=a5fff30d48c02000994b67d1a2c5762c^u_startBETWEENjavascript:gs.dateGenerate('2012-04-02','08:00:00')@javascript:gs.dateGenerate('2012-04-02','10:00:00')^ORu_endBETWEENjavascript:gs.dateGenerate('2012-04-02','08:00:00')@javascript:gs.dateGenerate('2012-04-02','10:00:00')^ORu_start<javascript:gs.dateGenerate('2012-04-02','08:00:00')^u_end>javascript:gs.dateGenerate('2012-04-02','10:00:00')
This can be expanded like this :
u_status=Validated ^sys_id!=a5fff30d48c02000994b67d1a2c5762c ^u_startBETWEENjavascript:gs.dateGenerate('2012-04-02','08:00:00')@javascript:gs.dateGenerate('2012-04-02','10:00:00') ^ORu_endBETWEENjavascript:gs.dateGenerate('2012-04-02','08:00:00')@javascript:gs.dateGenerate('2012-04-02','10:00:00') ^OR u_start<javascript:gs.dateGenerate('2012-04-02','08:00:00') ^u_end>javascript:gs.dateGenerate('2012-04-02','10:00:00')
It's a bit hard to code, as I wasn't able to find a complete reference documentation about this.
Any help will be welcome.
Regards,
Philippe

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2012 06:52 AM
Just set up a standard list filter on that table to show the records you want and then right-click the breadcrumb and copy the query. That will give you the correct encoded query string structure.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2012 08:04 AM
Hello Mark,
Thanks for you advice.
This is what I've done, and that why I've posted here : that's not working. The last AND stand at the same level than the two first ones.
Regards,