Quoted strings
- Last UpdatedJan 13, 2023
- 2 minute read
- PI System
- PI Server
There are two reasons to use quotes (single or double) with piconfig data:
-
The data contains an embedded delimiter character that will confuse correct parsing either on input or on output that is used in the future by piconfig itself or by other applications (such as Microsoft Excel).
-
The specific table requires certain data to be enclosed in quotes (single or double) for its own further processing. Examples include the PI Batch tables and the Performance Equation expressions configured in the extended-descriptor of a point.
piconfig attempts to parse incoming data into fields using the delimiter character. If a field starts with a quote (either single or double), piconfig ignores any delimiter until a matching quote is found.
When an already quoted string must contain embedded quotes, there are two options:
-
Enclose strings containing double quotes in single quotes and vice versa
-
Escape the embedded quotes with a backslash (\)
A field containing the delimiter character must be quoted. A field that starts with a quote should be quoted using the other type of quote. A field that starts with one type of quote and contains the other type as well should be quoted, and the embedded quotes must be escaped.
For example, a field containing:
unit,function
should be specified as
"unit,function"
or
'unit,function'
The expression
'sinusoid' > 'tag33'
should be specified as
"'sinusoid' > 'tag33'"
or
('sinusoid' > 'tag33')
The expression
'sinusoid' + "t-1d" + "ABC"
should be specified as
"'sinusoid' + \"t-1d\" + \"ABC\""
When the output from piconfig is used in another session or by another program such as Excel, make sure that fields containing the delimiter character are quoted (on output). Using the quote command does this:
@quote "
or
@quote '