Using Text Strings as Parameters in Functions
The following rules apply when text strings are used as parameters in functions:
Text strings supplied as parameters for a function must always be wrapped in quotes, regardless of whether they appear in the Recognition field or the Value field.
The CONCAT() function should be used to return a text string containing special characters such as ampersands that could be interpreted as a variable reference.
Double quotes (““) should be used to return one quotes character. Consequently, when a final text string result is expected to include leading and trailing quotes characters, the parameter supplied should be lead and trailed by three quotes characters, for example, ”””Hello”””.
To include a line break within a text string, use <NL>. For example:
prompt=Newline Message Prompt!!<NL>Line1<NL>Line2<NL>Line3
Creates the following text string:
Newline Message Prompt!! Line1 Line2 Line3
Newline Message Prompt!! Line1 Line2 Line3
Note: PTF will return an error (unrecognized / illegal variable format) if the user fails to wrap a text string being supplied as a parameter for a function in quotes.
This table shows examples of the text string used in the recognition field assuming the variable&MyVar is set to “Hello” (&MyVar=”Hello”) and the expected results:
Recognition |
Expected Result |
---|---|
CONCAT("&MyVar = " | &MyVar) |
&MyVar = Hello |
SUBSTR("Hello" | 1 | 5 ) |
Hello |
SUBSTR("""Hello """| 1 | 7 ) |
"Hello" |
INSTR("Hello" | "e" ) |
2 |
INSTR("""Hello"""| "e" ) |
3 |
INSTR("""Hello""" | ""e"") |
0 |
INSTR(Hello | e ) |
PTF returns error message |