Search code examples
servicenow

ServiceNow "Greater than or is", "Less than or is", and "Between" String compare operators


In a condition-type field, or in like a filter for a list, if I select a field that is a string-type field, there are three compare operators in the list of available operators that I do not understand the function of when it comes to strings. I was hoping someone could help me understand these three compare operators:

  1. Less than or is
  2. Greater than or is
  3. Between
  4. Also, what does "Matches Pattern" refer to? I at least understand the other three in other contexts, but what does "Matches Pattern" refer to, something about Regex, which I am familiar with?

Here is a screenshot so that you can see exactly what I am talking about, just to make sure I am being clear with what I am asking. Thank you in advance.

String operator screenshot


Solution

  • String operators

    With string less than and greater than take into consideration alphabetical order. Letter "A" is bigger than "B" and so on. If you provide more letter you will limit results even more.

    Having records:

    Albania
    Andorra
    Armenia
    Austria
    Azerbaijan
    Belarus
    Belgium
    Bosnia & Herzegovina
    Bulgaria
    

    When you filer greater than or is "Belg" you will receive the following result:

    Belgium
    Bosnia & Herzegovina
    Bulgaria
    

    When you filer, greater than or is "Belg" AND less than or is "Bo". You will see:

    Belgium
    Bosnia & Herzegovina
    

    You will get the same results using between operator.


    Matches Pattern

    Matches Pattern is pretty well described in documentation. Please have a look here for details doc link

    In short "pattern" is like regex but only have asterisk (*) and question mark (?). Asterisk means any number (including zero) of any character where question mark means exactly one.

    • the story matches the story but not that story.
    • *story matches the story and that story, but not that story is the best.
    • st?ry matches story and stxry, but not my story or stairy.
    • *b?gus* matches bogus, my bogus story, and His bagus machine, but not my bgus story or my baigus story.