08-15-2025 04:22 AM
Hello all,
I am automatically building a sequence file in TestStand 2017 and I also create custom data types in this context.
I would like to extract the enumerators of a custom data type ENUM that has been created during the Test Sequence build, to check whether I have to extend it by further elements.
The issue I face is that I can get access to the object and I can see the elements during runtime, but I cannot assign the values or names of the entries to an array.
The creation of the enum via handing over an array of containers with the elements EnumerationValue and EnumerationName using "(..)UpdateEnumerators(ContainerName)" works fine.
In a statement I do the following:
Locals.GetEnum= RunState.SequenceFile.AsPropertyObjectFile.TypeUsageList.GetTypeDefinition(Locals.TypeUsageList.GetTypeIndex("DEMO")).Enumerators
which gives a reference to the object. Now, how do I extract the values and names out of this reference? Please see the definition of the Custom data type Enum "DEMO" and the result of the statement above in the attached pictures.
Any ideas?
Thank you,
Chris
08-15-2025 05:58 AM
@Chris_KL wrote:
Hello all,
I am automatically building a sequence file in TestStand 2017 and I also create custom data types in this context.
I would like to extract the enumerators of a custom data type ENUM that has been created during the Test Sequence build, to check whether I have to extend it by further elements.
When creating/ updating a data type, you should increase its' version number upon saving. So you could go and use the version number to see if something has changed.
Maybe the Enum Function (don't know if this already exists in 2017) can help some way
08-15-2025 07:03 AM
Hello Oli,
thank you for the tip, but I am updating the enum several times during the run to have all the options required in this ENUM afterwards, so it would be handy to look through the Enumerators during runtime.
For now, I am mirroring the entries with a second list, a simple array, deleting and recreating the Enumerator entries every time I want to add an entry, which is not as practical as being able to read the Enumerator list.
Best regards,
Chris
08-18-2025 01:55 AM
Hey Chris,
I thought, I'd ask Nigel. And he came up wth some pretty creative ideas! Although they didn't work *, it nudged me into a direction:
You can get the number of possible enumerators as follows:
// Locals.MyVar is of the desired Enum-Type
// Locals.TypeRef is Type Object
Locals.TypeRef = Locals.MyVar.Enumerators,
Locals.NumOfElements = Locals.TypeRef.AsPropertyObject.GetNumElements()
* to be fair: this was the first time I saw Nigel hallucinating!