Advanced query with addEncodedQuery and operator priority

psiek
Kilo Contributor

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
2 REPLIES 2

Mark Stanger
Giga Sage

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.


psiek
Kilo Contributor

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,