How to create a GlideRecord Query for NOT STARTSWITH

Rajanmehta
Mega Guru

Hello

We are on Jakarta. I have a need to filter out IP address which starts with 172.

How can I add to my query? Any help on syntax would greatly appreciated.

rec.addQuery('ip_address', 'STARTSWITH','172.');   ( I want to add query like this but with negation i.e. Does not Starts with)

Thanks,

Rajan Mehta

1 ACCEPTED SOLUTION

Hi dan.bruhn,



Please help to convert this post from discussion to question. Thank you for your help.


View solution in original post

15 REPLIES 15

How to create one custom filter "NOT Start with"


This post might help you



Please mark my response as correct and helpful if it helped solved your question.
-Thanks

Thanks Prateek for your response.



I will look into your example you have mentioned.



I am looking for Glide record query.



Thanks,



Rajan Mehta


can we try something like this,



var rec = new GlideRecord('table_name');


rec.query();


while(rec.next()){


if(rec.getValue('ip_address').substring(0.3) != '172'){


//write your code here;


}


}


Thanks Shishir,



That work around did work. So but there isn't direct query filter for this, right?



Thanks,



Rajan Mehta


yes, that's not the direct query but using predefined javascript function we can filter out the not required data.