This section provides a generic description for the following methods:
AddNameValuePairINT
AddNameValuePairDINT
AddNameValuePairUDINT
AddNameValuePairREAL
AddNameValuePairSTRING
AddNameValuePairBOOL
As an example, the method AddNameValuePairINT is illustrated in the following figure:
Adds a name/value pair to the STRING that is being processed with the value being of the data type that is indicated in the name of the method:
INT = INTEGER
DINT = DOUBLE INTEGER
UDINT = UNSIGNED DOUBLE INTEGER
REAL = floating point value as per IEC data type REAL
STRING = STRING
BOOL = BOOL
The assigned value is converted, if required, to an ASCII STRING and added in the suitable format to the STRING that is being processed.
The return value is TRUE if the function was executed successfully. Evaluate the property Result
, in case the return value is FALSE.
Unsuccessful execution of the method can have the following causes:
Possible Cause |
Effect |
---|---|
The maximum length of the present STRING is reached. |
The STRING remains unchanged. |
Input |
Data type |
Description |
---|---|---|
i_sName |
STRING( |
Specifies the name of the name/value pair to be added.
The quotation marks surrounding the |
i_*Value |
* |
Specifies the value to be added. |
(*) Data type that corresponds to the method used. |
Calling the method AddNameValuePair<data type> adds the text marked in bold in the example to the STRING:
{"Key":1,"<name>":<value>}
<name>
corresponds to the value specified with the input i_sName of the method.
<value>
corresponds to the value specified with the input i_*Value of the method.