KeyVal - saving format of named values
On many places in the PROMOTIC system it is necessary to enter multiple named values in a single text. The format described below can be used for this purpose.
The format is very similar e.g. the syntax of
CSS styles in HTML pages.
Syntax:
Name1:Value1;Name2:Value2; ...
For example: "
Temperature:85;Pressure:1013.85;Name:Boiler1;"
-
Name: Represents value identifier that can be:
- Text identifier (value name):
This is the most common way of entering a value in the
KeyVal format.
This is a system name, so it must contain only alphanumeric and must not contain any diacritics (i.e. national dependent characters), empty string, spaces and first character must not be a number.
Example:
val1:13.5;val2:56;
When transforming the
KeyVal substring by the
PmMap.mapLoadFromString method the
PmMap object is created.
- Numeric identifier (value index):
Example:
0:13.5;1:56;
The first identifier must be 0 and following are ascending (1, 2, 3 …);
When transforming the
KeyVal substring by the
PmMap.mapLoadFromString method the
PmArray object is created.
All identifiers on given level must be of the same type (text or numeric).
-
Value: Follows after colon (:).
- If the value is a real number with a decimal point then the decimal separator must be a period.
- The value may contain character colon.
- The value
must not contain:
- Char semicolon (";"). Must be replaced by two characters: backslash and s ("\s")
- Char NewLine (0A hexa). Must be replaced by two characters: backslash and n ("\n")
- Char CarriageReturn (0D hexa). Must be replaced by two characters: backslash and r ("\r")
- Char backslash ("\"). Must be replaced by two characters: 2x backslash ("\\")
- Char left curly bracket ("{"). Must be replaced by two characters: backslash and o ("\o")
- Char pravá curly bracket ("{"). Must be replaced by two characters: backslash and c ("\c")
- If the value starts with the "left curly bracket" character then it must be finished with the "pravá curly bracket" character.
It means that the value is compound and there is a text in the KeyVal format inside the brackets.
Example:
"Temperature:85;Parameters:{p1:56;p2:64};"
- The value may contain empty characters at the beginning and at the end (space, tab) and these characters are considered to be valid.
It means that, for example, when saving into the
PmMap object (by the
mapSaveToString method) the value of the property will contain saved text including these empty characters (at the beginning or at the end).
This format can be used, e.g., for the following purposes:
- and many others
History:
Pm9.00.15: Added option of entering the name as number (i.e.
KeyVal of the
Array type).