To download NI software, including the products shown below, visit ni.com/downloads.
This example demonstrates how you can use the TestStand API to:
If you are not familiar with TestStand data types, refer to NI TestStand Type Management Best Practices for more information before using this example.
This example uses the TestStand API to create a new data type, and create an instance of the type in a sequence file:
Locals.SequenceFile = RunState.Engine.GetSequenceFileEx("", 107, ConflictHandler_UseGlobalType)
Locals.Type = RunState.Engine.GetTypeDefinition(Parameters.TypeName)
Locals.Type = RunState.Engine.NewDataType(PropValType_Container, False,"", 0)
Locals.SequenceFile.AsPropertyObjectFile.TypeUsageList.InsertType(Locals.Type, 0, TypeCategory_CustomDataTypes)
Locals.Type.AsPropertyObject.Name = Parameters.TypeName, Locals.Type.AsPropertyObject.SetValNumber("NumericField", PropOption_InsertIfMissing, 0), Locals.Type.AsPropertyObject.SetValString("StringField", PropOption_InsertIfMissing, "")
RunState.Engine.GetAdapterByKeyName(FlexCAdapterKeyName).AsCommonCAdapter.SetAllowStructPassing(Locals.Type, True), RunState.Engine.GetAdapterByKeyName(FlexLVAdapterKeyName).AsLabVIEWAdapter.SetClusterPassingEnabled(Locals.Type, True)
Locals.SequenceFile.AsSequenceFile.GetSequenceByName("MainSequence").Locals.NewSubProperty("instance", PropValType_NamedType, False, Parameters.TypeName, 0)
Locals.SequenceFile.AsSequenceFile.IncChangeCount()
Locals.SequenceFile.AsPropertyObjectFile.SaveFileIfModified(False), RunState.Engine.ReleaseSequenceFileEx(Locals.SequenceFile, 0)
Create Data Type Using TestStand API.zip
TestStand 2019 or Compatible
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.