11-07-2011 10:29 AM
I am using a select with multiple case statements. I am using one of the case statements to be used for multiple expression results. Specifically, the expression is a string and I want the same case to operate for values "1" and "4", but I can not find the syntax for this, does anyone know it?
11-07-2011 10:40 AM
Does the example UsingFlowControlSteps.seq in the TestStand Examples\SequenceFlow help in any way
11-07-2011 10:45 AM
Not really. I am wanting to know how I could make the same case sequence occur if either "1" or "2" was the expression. I am looking to reduce code rewriting for the same result that comes from multiple expressions.
11-08-2011 02:40 AM
Hi,
try this example.
08-02-2017 08:05 AM
I think you just need to put your values into an array like this...
{"1","2"}
12-21-2021 02:58 PM - edited 12-21-2021 03:00 PM
In your question you include two string representations of numbers: "1" and "4". In addition to discrete numeric, character and logical expressions, the TestStand case statement also allows for arrays of either strings or numbers to be used when a single case needs to match more than one expression result. Syntax for these arrays is:
case {expression_1, expression_2,...,expression_n} //matches any of the expressions contained in {...}
Where expression can be a numeric value or a string value.
case {"string_1", "string_2"}
and
case {1,2,3,4,5,6,7,8}
are both legal case arrays
There is no limit on the number of expressions.
Note, unlike some extensions of the C switch:case statement, case ranges such as 5:20 (matching any value from 5 to 20) are not legal. case arrays can only contain a number of discrete expressions
An example showing a numeric array can be seen in the PromptForInput sub-sequence on the second case statement <teststand directory>\Examples\Built-In Step Types\Message Popup Step Type\Message Popup Step Type - Get User Input.seq
(C:\Users\Public\Documents\National Instruments\TestStand YYYY (32-bit) is a typical path for <teststand directory>)
05-09-2023 02:37 PM
I tried entering an array of numbers, but it gave an error that it could not compare an array of numbers to the selection, which was a single integer.