% ( Wildcard)
Used with the LIKE operator to construct patterns for matching.
Used with the LIKE operator in logic expressions, the % wildcard matches zero or any number of subsequent characters when the pattern on the right is compared to expression1.
Matches any character string whose second and third letters are ob, followed by zero or more characters (i.e., “Robert”, “Bob”, “Cobbler”, etc.).
compute Employees where LastName like “_ a%n”
Processes all records whose LastName values are three characters or more, the second character being an a and the last character being an n.
Grade like “100\%”
Shows the percent sign being used literally in a string. (The first backslash “escapes” the second backslash, which, in turn, “escapes” the percent sign, turning it into a literal character.)
find Parts where PartDesc like “%\\%”
Finds parts whose part description contains a backslash.
FirstName like $ concat(” S_e%p”, SuffixVariable)
Assuming that SuffixVariable is “%”, then the above expression is logically true if FirstName matches the pattern S_e%p%.
The LIKE Operator, The %Wildcard and SQL Servers
The LIKE Operator with %Wildcard sometimes operate differently in SQL servers than in ZIM. The following construction:
find Parts where PartDesc like “%e”
in some SQL servers might only retrieve records when the PartDesc ends exactly with an “e” in the last position of the field. If PartDesc is 5 characters long, the “rode” and “are” will not be retrieved, whereas “there” and “force” will be.
To solve this situation, the above construction must be written this way:
find Parts where $trim(PartDesc) like “%e”