From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

Use Array of Numbers as Select "Item to Compare"

Solved!
Go to solution

Greetings,

 

I'm curious in how to use an array of numbers as the value in the Select edit tab. Ideally my "cases" would execute a "Contains(Locals.arrayofnumbers,0)" expression.

 

Basic Principle:

1. Labview VI launches with ListBox containing all the tests (multiple selections enabled)

    OUTPUT is an array of I32.

2. I32 array is assigned to Locals.arrayofnumbers

3. Locals.arrayofnumbers is used under Select "item to compare"

4. Each CASE has the following statement....."Contains(Locals.arrayofnumbers,#)"

**each case would have 1 sequence to execute**

 

Currently TS throws an error prompt indicating that Select step is expecting number, found array of numbers.

 

I have already found a quick, pretty clean solution by just instituiting a pre-condition for each sequence and elminate the flow control all together. But I'd rather not use pre-conditions for overall flow control if at all possible, and use the intended flow control steps as intended.

 

I've used TS Help, but didn't quite give me what I needed. Maybe I didn't use the correct search string. The forum here, is the same. I'm pretty sure the answer may be out there but maybe I'm using the wrong search string.

 

Thanks in advance for any help.

 

To SUM UP: User selects (via LabVIEW listbox) 1 - n tests to be ran (outputted by I32 array). I32 array is used for case selections by evaluating "Contains(Local.arrayofnumbers, 0)"

 

Regards,

 

chazzzmd78

0 Kudos
Message 1 of 3
(4,489 Views)
Solution
Accepted by topic author chazzzmd78

Honestly a Select/Case system is the wrong choice for what you are doing.  I would go with the precondition options.  It reduces the number of steps in TestStand. 

 

In your case you are just seeing if something exists or not in an array.  Ideally you would use the Select/Case steps when you have 1 option selected from many.  I'm assuming you are looping around the select case so that you can run all of the tests so your code looks something like this:

 

For N (N is the number of tests they've selected)

Select Locals.ArrayOfNumbers

Case Contains(Locals.ArrayOfNumbers, 1)

Execute test 1

Case Contains(Locals.ArrayOfNumbers, 2)

execute test 2

Close Select

Close For Loop

 

If you want to use the Select/Case option correctly I would do it like this:

ForEach element in Locals.ArrayOfNumbers (assign the current element to Locals.i)

Select Locals.i

Case 1

Execute test 1

Case 2

Execute test 2

Close Select

Close ForEach

 

Hopefully this makes more sense.  If you have questions let me know.

 

Regards,

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

Jigga,

 

Thanks for the response its helpful. yeah, for this specific project unfortunately case selects are darn near a requirement. I agree about the pre-conditions, and if the decision was mine I'd do it.

 

Your last "brick" of execution is what I need. Can't believe I didn't see that low lying fruit.

 

Thanks again Jigga

0 Kudos
Message 3 of 3
(4,478 Views)