Specifying the Data Field Delimiter
- Last UpdatedJan 24, 2023
- 1 minute read
When data is sent from a data server to Query, it is sent as a single data block. Each data field within the block is delimited by a special character; by default, this is the ~ (tilde) character. When Query receives the block, it uses the delimiter character to determine the points at which to split the data into individual fields. If the data includes the delimiter character within a text field, Query will split the data block at the wrong point.
For example, the data stored in the following fields would be received by Query, using the default ~ delimiter as the data block.
|
Area |
Catalytic Cracker |
|
Plant |
Reflux~Heater |
|
Code |
DES21142 |
Catalytic Cracker~Reflux~Heater~DES21142
and would be split, incorrectly, into the fields:
|
$!a[1] |
Catalytic Cracker |
|
$!a[2] |
Reflux |
|
$!a[3] |
Heater |
|
$!a[4] |
DES21142 |
To prevent this effect, you can redefine the delimiter character to be any single character which is not used within any DB field. To do so, use the command:
EXTERnal DELImit token text_char
Here, 'token' is the token for the communication channel which was supplied by a successful EXTERNAL OPEN command (and stored in the token_var variable) and text_char is the required data field delimiter character.
For example, the following specification would cause the data block from the example:
EXTERNAL DELIMIT $!!MAINT ’&’
to be received as:
Catalytic Cracker&Reflux~Heater&DES21142
This would be correctly split at the points identified by the '&' characters.