NI TestStand Idea Exchange

About NI TestStand Idea Exchange

Do you have a feature idea for how to improve NI TestStand? Submit and vote on ideas now!

  1. Browse by label or search in the TestStand Idea Exchange to see if your idea has previously been submitted. If your idea exists sure to vote for the idea by giving it kudos to indicate your approval!
  2. If your idea has not been submitted click Post New Idea to submit a product idea. Be sure to submit a separate post for each idea. Note: the TestStand Idea Exchange is not the appropriate forum to submit technical support questions.
  3. Watch as the community gives your idea kudos and adds their input.
  4. As NI R&D considers the idea, they will change the idea status.
  5. Give kudos to other ideas that you would like to see implemented!

The TestStand R&D team is committed to reviewing every idea submitted via the TestStand Idea Exchange. However, we cannot guarantee the implementation of any TestStand Idea Exchange submission until further documented.

Top Kudoed Authors
User Kudos Count
1
1
Showing results for 
Search instead for 
Did you mean: 

select case should support multiple values

For some reason I was certain this was already in the idea exchange, but I couldn't find it -- so I'll post it.

 

Select Case structures are frustratingly difficult to use if you want one case to support multiple values.

 

In text languages you can often do something like

 

Switch (Foo) {

Case 1:

execute this code;

Case 2:

execute this code;

Case 3:

Case 4:

Case 5:

execute this code;

Case 6:

execute this code;

Default:

execute this code;

}

 

Notice that the case for 3,4,5 is all the same, and I just need to put it in place once.

TestStand can't do this.  You need to do something like this:

how to do select case on multiple values

which is horribly difficult to write, maintain, and understand what is happening.  It would be MUCH easier if select case on multiple values worked like this:

SelectCaseImplementA.png

where it looks just like other text based languages, although it takes up quite a bit of realestate on the screen.

or maybe something like this:

SelectCaseImplementB.png

where I can just type in a comma separated list of allowed values.  The similarity with text based languages disappears here, but it is much smaller on screen (but notice how it shows nicely in the description field) and lines up better with LabVIEW notation.

 

 

Note: LabVIEW already supports doing this, and also supports ranges of values (eg 3, 5..10, 12 for numerics) which would also be nice, and also supports case sensitive and insensitive comparison for cases. 

5 Comments
crossrulz
N/A

I like the idea of mimicing the syntax of the LabVIEW case structure.

Josh_W
N/A

I propose using an array where if the value matches any value in the array then the case executes. Additional text "pass array to match multiple values" would be added to the dialog/step pane.

 

There is already precident for this behavior in TestStand steps.

  • In the Queue step, if an array is specified when dequeueing, TestStand will dequeue from the first available queue.
  • The Lock and Notification steps allow arrays to be passed to operate on multiple items.

I think this would work better than a comma separated list, because commas already have a different meaning in a TestStand expression.

Lars_L
N/A
Status changed to: In Beta
 
MimiKLM
N/A

I'd like to ad an extension to this thread. I've spotted dangerous error (dangerous because is difficult to track).

 

Description:
Case statement allows multiple elements to fill in, however it doesn't match them. Regrettably, instead of throwing an error, it allows the data to be written and parsed its syntax positively, misleadingly leading to very difficult error to be captured.

 

___9e45aafe55790603378762ec623a8ad0.png

 

 

It is ambiguous. It shall thrown an error, even if the docs says that only case allows only one element to do the match.

 

And the hint: "Value to Compare (examples:3.14159, ..." in the step settings misleadingly suggest that comma separation is OK.

 

Could you please pay attention to the comments as well in the next release, please?

 

Lars_L
N/A
Status changed to: Completed
I'm happy to announce that this feature is included in the now released NI TestStand 2013! For more details on the feature or to download the new version and give it a spin, check out www.ni.com/teststand/whatsnew