I need to iterate over steps that has Additional Results. Additional Result container can have different data type.
How can the ForEach loop variable be defined such that it can accept any data type? Dont see "varaint" in TestStand.
Just store them in an empty container. So make a variable like Locals.AContainer that is just an empty container. Then you can access the subproperties. The key is that at edit time you won't see what's there but during execution it works fine.
Not sure if I understand completely. The type mismatch happens with Current Element of ForEach loop. Attach is the ForEach loop setting and Current Element whic is of type Numeric currently. Tested after chaning to Current Element type to String but still errors out.
Taking an example.
Current Element type set to Numeric.
I have 2 steps and for 1st step the AdditionaResults has a Numeric type value. For the 2nd step AdditionalResult has String type value.
When the ForEach executes, 1st step AdditionalResults iteration passes but for the 2nd step a type mismatch is found (String versus Numeric).
I am guessing in order to store the AdditonalResults in empty container, it will still need to iterate and ForEach will again error out.
The other approach I am thinking is to have switch-case statement but then that does not look like a clean implementation as one case for every datatype would be required.
You will have to create some sort of select statement for each of the types if you want to get the values as they are.
There's probably a better way to use the API for this but this should help with your current situation.