The ASCII Stream Enum Parser Transform accepts an ASCII string from a COM port in the form of a message Signal. The input string (stream) is parsed for Enum labels defined in the user-provided CSV file. If an Enum is found, its value is transmitted from the corresponding outport. If no Enum is found, the input string is transmitted from the General Out Port.
CSV File Format
If the Enum value is not provided in the CSV file, the first label is assigned a value of zero. Each subsequent label is assigned the value of the previous label plus 1.
Switch, Off, Low, High
is equivalent to:
Switch, Off=0, Low=1, High=2
; This is an example of an Enums import file
; Format definition:
; SignalName, EnumName/Value, EnumName/Value,
; Columns are separated by a comma
; The first column is the SignalName
; After Signal Name there can be any number of Enum Name/Value pairs
; EnumName/Value pairs
; The EnumName cannot be empty
; The Enum Value is optional
; If the EnumValue is not provided then we use zero or the last value+1 for that Signal.
; The EnumName and EnumValue are delimited by '=' or [space]
Power Mode, ACC
Configuring the Transform
In MxTransIt, click on the Transform to display its Properties box:
Use the CSV File path property to select the input CSV file.
If the Update property is set to True, input strings that are not already defined in the CSV file are appended at run time.
Click the Regenerate Ports verb to create an outport for each Signal defined in the CSV file.