Jelly UI Page - less than / greater query

nhague
Tera Contributor

Hi All

I'm trying to write a UI page to do a glide query with a 'greater than' or 'less than' operator but the xml doesn't like it !

How do i do .....
gr.addQuery("priority", ">", "3");
or ...gr.addQuery("priority", "<", "3");

I'll also need to run queries by date also.. something like...
gr.addQuery('u_time', '<', start);

I've had a look at using ${AMP}lt; and ${AMP}gt; but can't seem to get the syntax correct.
(http://wiki.servicenow.com/index.php?title=Extensions_to_Jelly_Syntax#Less_Than)

UI Page XML attached.

Hoping that this is a very quick syntax issue.

Thanks in advance.

6 REPLIES 6

neetusingh
Giga Guru

You can try with this snippet. I tested it and is working fine.


var queryString = "priority=1^ORpriority=2";
var gr = new GlideRecord("incident");
gr.addQuery("active", true);
gr.addEncodedQuery(queryString);
gr.query();
gr;


I hope this gives you some insight..


nhague
Tera Contributor

Found it ! answered my own question !


<<less than
>>greater than

gr.addQuery("priority","<","3");
or
gr.addQuery("priority",">","3");




Hi Nick,



I am having trouble with the less than operator in my UI Macro script



gr.addQuery("priority","<","3"); is not working.   The greater than operator is working though.



Any idea how I can escape the character?



Thanks,


Jenny


have you tried with ${GT}



gr.addQuery("priority",${GT},"3");


or


gr.addQuery("priority",'${GT}',"3");