#LIKEF#
Description
The #LIKEF# and #LIKEW# reserved words are similar to the #FAIL# and #WARN# reserved words except that they look for similar values, not an exact match. If a similar match is not found, #LIKEF# logs a Fail and #LIKEW# logs a Warning.
Similar to the behavior of #FAIL# and #WARN# (and unlike the behavior of #CHECK#), if the comparison fails, PTF does not update the value. The steps only affect the error state of the execution log.
This table details ways #LIKEW# or #LIKEF# can match strings:
| Type of Match | Pattern | Match (Log a Pass) | No Match (Log a Fail or Warn) |
|---|---|---|---|
|
Multiple characters |
a*a |
aa, aBa, aBBBa |
ABC |
|
Multiple characters |
*ab* |
abc, AABB, Xab |
aZb , bac |
|
Multiple characters |
ab* |
abcdefg, abc |
cab, aab |
|
Special character |
a[*]a |
a*a |
Aaa |
|
Single character |
a?a |
aaa, a3a, aBa |
ABBBa |
|
Single digit |
a#a |
a0a, a1a, a2a |
aaa, a10a |
|
Range of characters |
[a-z] |
f, p, j |
2, & |
|
Outside a range |
[!a-z] |
9, &, % |
b, a |
|
Not a digit |
[!0-9] |
A, a, &, |
0, 1, 9 |
|
Combined |
a[!b-m]# |
~ An9, az0, a99 |
abc, aj0 |
Example
Suppose a test requires verification of only the first several characters of a text entry. In the following example, the first step logs a Fail if the first two characters of the Benefit Plan field are not equal to US. The second step logs a Fail unless the first two characters of the Benefit Plan field are equal to US and the last character is equal to 1:
| Type | Action | Recognition | Parameters | Value |
|---|---|---|---|---|
|
Text |
Set_Value |
Name=PA_BENEFIT_PLAN |
|
#LIKEF#US* |
|
Text |
Set_Value |
Name=PA_BENEFIT_PLAN |
|
#LIKEF#US*1 |
#LIKEF# and #LIKEW# only compare the date text of a date/time value. For example, some fields contain the current date and time. Use the #LIKEF##TODAY* construction to compare just the date portion of a Datetime field and ignore the time portion.
For example:
| Type | Action | Recognition | Parameters | Value |
|---|---|---|---|---|
|
Text |
Set_Value |
Name=PA_PROP_VOUCH_DTTM |
|
#LIKEF##TODAY* |