Logging Enumerations as Strings
- Updated2025-07-23
- 2 minute(s) read
The default TestStand schemas only log the numeric values for Enumeration data types in the PROP_RESULT and PROP_BINARY tables.
To log the name/string value of all Enumeration types, you can modify the schema for the PROP_RESULT table in the following manner:
- Open Configure»Result Processing»Database to edit the schema TestStand uses for Database logging.
- Select the DATA column in the
PROP_RESULT table of the schema you are using and modify
the Value To Log field to use a conditional expression:
Logging.PropertyResultDetails.Type.ValueType==7? Str(Logging.PropertyResult):Logging.PropertyResult
Note If you are using a default schema, make a copy of the schema and edit the copy to make these changes.
Similarly, you can use the GetValString method on the Logging.PropertyResult object to obtain the string value of an enum and log it in a new column.
Note The new expression in
Value To Log will give an evaluation error at edit-time, but
evaluates correctly at run-time.
To Log the string and numeric value of all enumeration types, modify the expression in step 2 above to:
Logging.PropertyResultDetails.Type.ValueType==7?
Logging.PropertyResult.GetValueDisplayName(“”,0):Logging.PropertyResult
To log an array of enumeration as a single string, modify the schema for the PROP_RESULT table as follows:
- Open Configure»Result Processing»Database to edit the schema TestStand uses for Database logging.
- Select the DATA column in the
PROP_RESULT table of the schema you are using. Modify the
Precondition expression
from
(Logging.PropertyResultDetails.Type.ValueType>0&& Logging.PropertyResultDetails.Type.ValueType<4)|| Logging.PropertyResultDetails.Type.ValueType==7
to(Logging.PropertyResultDetails.Type.ValueType<0&& Logging.PropertyResultDetails.Type.ValueType<4)|| Logging.PropertyResultDetails.Type.ValueType==7|| (Logging.PropertyResultDetails.Type.ValueType== 6/*array*/&& Logging.PropertyResultDetails.Type.ElementType.ValueType==7/*enum*/)
- Modify the Value To Log expression
to
(Logging.PropertyResultDetails.Type.ValueType==6/*array*/&&Logging. PropertyResultDetails.Type.ElementType.ValueType==7/*enum*/)? Str(Logging.PropertyResult,“%s”,1,False,“.”):Logging.PropertyResult
Note This logs the
enumerator array as a single string composed of the string values of the enumerator
array elements delimited by a comma. The data will be logged to the
PROP_RESULT table.