From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Data type TestStand

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.

*************************************************
CLD
*************************************************
0 Kudos
Message 1 of 5
(2,848 Views)

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.

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 5
(2,840 Views)

jigg,

 

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.

 

Thanks.

*************************************************
CLD
*************************************************
0 Kudos
Message 3 of 5
(2,834 Views)

I'm not sure I completely understand what is going on. Can you post your sequence file?

Rohama K.
0 Kudos
Message 4 of 5
(2,792 Views)

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.

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 5 of 5
(2,782 Views)