cnsSetProperty
Sets the properties for the given node as key/value pair.
Synopsis
bool cnsSetProperty(string cnsPath, string key, anytype value);
Parameters
Parameter | Description |
---|---|
cnsPath | ID path of the node |
key | Key name |
value | Key value |
Return value
TRUE or FALSE indicating success or failure of the operation.
Errors
Possible errors:
-
Wrong or missing parameters
-
The defined node could not be found
-
The key/value pair exceeds the maximum length for node properties (256 bytes). Therefore, the pair cannot be added.
Description
It is possible to save properties as key/value pairs for CNS nodes. This function sets the property for the defined node. If the specified key does not exist, it is created with the given value. If the key already exists only the value is updated. A maximum of 256 byte (sum of length of key, value and internal control characters) can be stored per node.
The following keys are already used by WinCC OA internally:
Key | Value |
---|---|
OA:ICON | Name of the icon (including the path relative to the pictures folder) that shall be set for the node. |
OA:OPC |
Appropriate bit pattern to define the AccessLevel. E.g. 3 to set the bits for read & write. Refer to the CNS chapter of the respective OPC server for further information on the AccessLevel. |
OA:MOD | Number of used registers (refer to Modbus/TCP server details or Plantmodel Editor - Modbus |
OA:DMOD | Number of dyn elements (refer to Modbus/TCP server details or Plantmodel Editor - Modbus |
OPC
main()
{
cnsSetProperty("System1.View1:Node3.Node1", "OA:OPC", 5);
}
Availability
UI, CTRL