The CreatorCon Call for Content is officially open! Get started here.

how to query the table with conditions using addQuery?

msm4
Mega Guru

Hi Team,

I am trying to get the data from the table, based on two conditions, the below snippet I am trying to pull the records from the table which has "type=x & type=y".

Can anyone please guide me.

<g:evaluate var="jvar_gr" object="true">

  var gr = new GlideRecord("table_name");

  var gr2=gr.addQuery('type','x');

    gr2.addorCondition('type','y');

  gr2.addEncodedQuery('beginONToday@javascript:gs.daysAgoStart(0)@javascript:gs.daysAgoEnd(0)')

  gr2.query();

  gr2;

</g:evaluate>

Thanks in advance.

1 ACCEPTED SOLUTION

It is addOrCondition, not addorCondition.



You can also string it: gr.addQuery('type','x').addOrCondition('type','y'); and forget the second variable declaration.


View solution in original post

8 REPLIES 8

It is addOrCondition, not addorCondition.



You can also string it: gr.addQuery('type','x').addOrCondition('type','y'); and forget the second variable declaration.


Hey Mike ,


Thanks a lot . its working.


Can you mark my answer as correct if it helped you solve the issue?   Thanks.


Kalaiarasan Pus
Giga Sage

Form the condition on the list view table using table filter. Right click on the filter and copy query.



Now use the copied query in addEncodedQuery and query the data.