Check case sensitive in addQuery filter condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2020 04:14 AM
Hi All,
I have a reference field in my catalog form, on choosing of values fetching data from another table. Here I have duplicate names for some records but case sensitive is different. So I just want to get result data only to the name which I passed.
For example.
var gr= new GlideRecord('location');
gr.addQuery('country','INdia'); //should return exact results of INdia not india,INDIA and whatever is available in table.
gr.Query();
Can anyone suggest some ideas ?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2020 04:59 AM
what will matches = filter.match(currentRecord, true); do here? Because I just tried only with filter.setCaseSensitive(true);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2020 05:36 AM
GlideRecord queries are not case sensitive. You have to add another check like GildeFilter as you suggest below.
Recently ran into this same issue when GlideRecord would match these two:
KnvZfZ7vAde
KnvZfZ7vAdE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2020 04:38 AM
Hi,
addQuery() is doing a case insensitive search; so you want case sensitive search?
addEncodedQuery() is also case insensitive search
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2020 04:54 AM
Yea I want case insensitive search. Even I tried with grBS.setCaseSensitive(true); but its not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2020 05:10 AM
I hope this article will helpful to me ,but am confused with the code .Can you please show me the same for my code?