Using Wildcard (%W) in an ActionWare
Filter
The Wildcard compare type (%W) in an ActionWare filter is
used to specify a pattern that performs a wildcard scan of a
character field.
It can be used to find multiple characters, or strings of
characters, in a field. It is similar to the 'contains' function, except
that with 'contains' you can only search for a single string of characters
within a field. Wildcard is much more versatile.
When using wildcard, there are two characters with special
meanings, these are called wildcard characters. They are (1) an underscore
('_') to match any single character, and (2) an asterisk ('*') to match a
string of characters. Because they have this special meaning,
underscores and asterisks cannot be searched for as data
characters when doing a wildcard scan.
An underscore means any character in that position in the
field is acceptable. Any number of underscores can be
specified.
An asterisk before a character indicates any number
of any characters are acceptable up to that character. An
asterisk after a character indicates any number of any characters
are acceptable beyond that character. Zero, one, or two
asterisks can be specified.
Note that an underscore (sometimes called an
underline) character is virtually invisible if you are looking at
it in an input field where the whole field is already underlined by
default. This can be very confusing.
The apostrophe also needs special care. If you
do want to use an apostrophe in the Compare Data field, it must be
entered as two apostrophes. For example, if you are searching for contact
records that have the character string NAT'L in the company name, you must use
NAT''L in the compare data. WARNING- Do not confuse using two adjacent
single apostrophes with the double quote character. In some fonts it
is not possible to tell the difference between two adjacent single
apostrophes and one double quote character.
Examples are a good way of understanding how Wildcard
works.
Example 1
The following example selects only records where the
character field FLD contains a 'T', followed by any two characters and an 'E',
appearing anywhere in the field.
Field Compare Compare
Name Type String
fld %W
"*T__E*"
Note: The
asterisks at the start and end of the pattern-string are required to allow the
'T' and 'E' to appear somewhere other than the first and last positions in the
field:
Example 2
To select only records where the character field FLD starts with the string
'ABC', followed by one or more other characters and then followed by the string
'XYZ' (but not necessarily at the end of the field), specify the following:
Field
Compare Compare
Name
Type String
fld %W
"ABC_*XYZ*"
Example 3
To select only records where the character field FLD starts
with the string 'ABC', and then followed by the string 'XYZ' (but not
necessarily at the end of the field), specify the following:
Field Compare Compare
Name
Type String
fld %W
"ABC*XYZ*"
Note: There's a prize for accurately describing the
difference between Examples 2 & 3.
Example 4
To select only records where the second character of field FLD is the
letter B, the last character is the letter Z, and the letter M appears somewhere
in between, specify the following:
Field Compare Compare
Name
Type String
fld %W
"_B*M*Z"