Converting non-string values to string

If you want to use a non-string value as a string, you first need to convert it to the String data type. For example, if you want to use the value of a data item in an audit message and that data item is not of the String type, you need to convert the value to a string, as shown in the following example, where temp is an analog value:

Then/Else: Audit("data-management", "Received temperature update. Value is " + str(DataItem.temp.value))

In general, use the str() function when creating audit messages that contain ANALOG or DIGITAL data items or the LOCATION variable.

You also would use the str() function when creating audit messages that contain the value of a symbol that is of the numeric data type. For example, if you want to write an audit message that contains the severity of an alarm:

Then/Else: Audit("data-management", "The severity of the temperature alarm is " + str(Alarm.severity))