Creating a Standard Quote-Delimited String
Character strings must be enclosed in single quotation marks to be handled by most database
engines. In addition, embedded single quotation marks are indicated by two contiguous
single quotation marks. Quotation marks are required around variables containing delimiters,
which include spaces and commas.
The QUOTEDSTRING suffix on a Dialogue Manager variable applies the following two
conversions to the contents of the variable:
Any single quotation mark embedded within a string is converted to two single quotation
marks.
Single quotation marks are added around the string.
Dialogue Manager commands differ in their ability to handle character strings that are not
enclosed in single quotation marks and contain embedded blanks. An explicit or implied -
PROMPT command can read such a string. The entire input string is then enclosed in single
quotation marks when operated on by .QUOTEDSTRING.
Note: When using the -SET command to reference a character string, ensure the character
string is enclosed in single quotes to prevent errors.
Syntax: How to Create a Standard Quote-Delimited Character String
&var.QUOTEDSTRING
where: &var Is a Dialogue Manager variable.
Creating a Standard Quote-Delimited Character String
The following example shows the results of the QUOTEDSTRING suffix on input strings.
-SET &A = ABC;
-SET &B = 'ABC';
-SET &C = O'BRIEN;
-SET &D = 'O'BRIEN';
-SET &E = 'O''BRIEN';
-SET &F = O''BRIEN;
-SET &G = OBRIEN';
-TYPE ORIGINAL = &A QUOTED = &A.QUOTEDSTRING
-TYPE ORIGINAL = &B QUOTED = &B.QUOTEDSTRING
-TYPE ORIGINAL = &C QUOTED = &C.QUOTEDSTRING
-TYPE ORIGINAL = &D QUOTED = &D.QUOTEDSTRING
-TYPE ORIGINAL = &E QUOTED = &E.QUOTEDSTRING
-TYPE ORIGINAL = &F QUOTED = &F.QUOTEDSTRING
-TYPE ORIGINAL = &G QUOTED = &G.QUOTEDSTRING
The output is:
ORIGINAL = ABC QUOTED = 'ABC'
ORIGINAL = ABC QUOTED = 'ABC'
ORIGINAL = O'BRIEN QUOTED = 'O''BRIEN'
ORIGINAL = O'BRIEN QUOTED = 'O''BRIEN'
ORIGINAL = O'BRIEN QUOTED = 'O''BRIEN'
ORIGINAL = O''BRIEN QUOTED = 'O''''BRIEN'
ORIGINAL = OBRIEN' QUOTED = 'OBRIEN'''
Note: The -SET command will remove single quotes around a string. Notice in the example
above that the result of -SET &B = 'ABC' was changed to ORIGINAL = ABC (as shown in the
output), prior to the QUOTEDSTRING conversion.
Source: DN4500991.0310
WebFOCUS 8.1.05 / APP Studio