- 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
08-18-2020 10:54 AM
Hi
I just have a proposal of how you could simulate this scenario.
You can "exclude" certain "ranges" of values, by having TWO "BETWEEN" conditions "ORed" together.
See the next screenshot for an example:
In this example, I use the field "Info" on a custom table, which is a String type field.
I have TWO ranges for the condition; both with BETWEEN:
The first range has all values between "a" and "IB"...
Then i "Exclude" everything starting with "IC" by starting the next range at "ID" and ends "open".
This will exclude all Records starting with "IC", but also the ones with "IBa", "IBc" and so on.
If you want to include also "IBa", "IBb", etc, just run the first range up to "IBz" for example.
This way, you can simulate something like "DOES NOT START WITH".
This is just a workaround, but as there is no such OOB function, this at least helps somewhat.
Let me know, if that answers your question and mark my answer as correct and helpful.
Enjoy & BR
Dirk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2021 09:52 AM
This is a neat manipulation to produce the desired result.
I came here looking for a solution for filtering the Subject on sys_email table and this works brilliantly until I start hitting special characters. For instance, I'm not sure if a { is less than or greater than a ~. I was thinking it could be ascii valued, but the ServiceNow filter seems to be case insensitive.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2021 11:27 AM
So turns out it wasn't so hard to figure out what the order is for special characters. I just created a new table, added a string field (non UTF-8) and added all the special characters to the tables. Then if you open the table, you can sort the records. Below is the sort order of the special characters from first to last (lowest to highest). I only added one letter into the results below, just to show how the instance was sorting letters versus the special characters. You can test your own filters against the list. Seemed to be working in my own tests.
!
"
#
$
%
&
'
(
)
*
+
,
-
.
/
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
?
@
A
[
\
]
^
_
`
{
|
}
~
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2022 06:27 AM
Thanks Dirk, this is exactly what I was needing in my scenario. I needed entries that do not start with "DV".
The accepted "gr.addQuery('name', 'NOT LIKE', 'DV%');" solution, though more polished in appearance, simply did not work for me; it apparently produced an invalid query, as I began returning all records. I would have preferred using that one had it worked, but I'm glad to have your solution! Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2020 09:02 AM
Thanks all, but what I was exactly looking for is that I need "DOES NOT START WITH" to be shown as a operator in the list filter. And I want that filter to do the job.
The solution by
The solution by
Extremely thankful for the responses here and I apologize for responding late on this thread.