
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2020 02:42 AM
Dear all,
This was asked 5 years ago, unanswered. Asking it again to a much wider audience now, hopefully.
Can someone suggest that script include for DOES NOT START WITH and how to call that from a advanced filter? Please don't refer me to threads, even the thread marked as RESOLVED does not have the solution in it. Any help is appreciated.
I know one solution is to create a advanced filter and calling a script include. But I would need the solution instead of the approach.
Any answers?
Regards,
Anish
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2021 05:20 AM
Hi Anish,
it's a while ago, but maybe someone will find this answer helpfull.
The solution from my point of view is to use SQL 'LIKE' operator which work even though it's not documented for GlideRecord:
gr.addQuery('name', 'NOT LIKE', 'StartString%');
Pls mark as helpful if solution works.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2020 03:00 AM
Hi
Can give an example of what you are looking for?
Do you want to have a Script Include with a function to check if a string "DOES NOT START WITH" a certain string?
Or are you planning to create some dynamic Filter Script, that you can use inside of Condition Builders?
Just let me know,please
BR
Dirk

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2020 03:04 AM
I would prefer to have it in the condition builder. If that's possible, it's a good one to meet my requirement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2020 04:47 AM
I'm assuming a lot of details about your requirement here, so let me know if your specifics aren't in line. For this example I have a reference variable on a catalog item. The variable is referencing the core_company table in my OOTB Orlando PDI. This is what it looks like with no reference qualifier.
Now I have added an Advanced Reference qualifier
javascript:new Companies().getFilteredCOs();
I'll skip to the end and show the results first when I return records that do not start with 'ACME'.
To accomplish this, create a Script Include with the same name and function referenced in the qualifier. Make sure the Client callable box is checked. Here is the script I used for this simple example. You could also pass in the 'does not start with' text string from another field/variable as a function parameter.
var Companies = Class.create();
Companies.prototype = {
initialize: function() {
},
getFilteredCOs:function(){
var colist = [];
var dnswText = 'ACME';
var gr = new GlideRecord('core_company');
gr.query();
while(gr.next()){
if(gr.name.indexOf(dnswText) == -1 || gr.name.indexOf(dnswText) != 0){ //string not found or not at beginning of Name field
colist.push(gr.sys_id.toString());
}
}
return 'sys_idIN' + colist.join(',');
},
type: 'Companies'
};

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2020 05:06 AM
Hey Brad,
I must thank you for the detailed explanation first.
Is it possible that I can dynamically enter values and get results as we do with "STARTS WITH", because if I have to change the keyword, I would have to modify the script here.
Thanks again,
Anish