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: 

Problem by Message Popup Teststand

Solved!
Go to solution

Hello

sorry my English ist not perfekt:smiley sad:

 

 I have created an opportunity to make a choice of 5 elements on Message (Foto) so that when if you selected  Can1, only  Can1 be executed and to achieve this I have to go on Propreties-> Expression -> Post expression to write a condition where Locals.CanType declared is equals one of Buttons

in an example Teststand "computer6" I saw it on writing this expression at term Post Expression :

Locals.CPUType = ((Step.Result.ButtonHit == 2) "AMD": "INTEL") <<  this condition is valid for 2 buttons >>

 

The problem is: how can I write a condition on the Post valid expression for 5 buttons  ie that we must choose between the CanX, Can1, Can2, Can3 or Can4.

thank you in advance

0 Kudos
Message 1 of 22
(5,468 Views)

What do you want to store in your local variable "CanType"?

Is it a string which reflects the label of the button?

 

I doubt that you need a case construct at all.

Possibly, something like "Locals.CanType = Evaluate("Step.Button"+Str(Step.Result.ButtonHit)+"Label")" could do the trick.

 

hope this helps,

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 22
(5,457 Views)

Another simple option is to create an array with the possible values and then just index the value that was chosen with the button.

 

Locals.CanType = CanTypeArray[Step.Result.ButtonHit-1] //If the array is 0 based, you will need to subtract 1 from the ButtonHit result


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 22
(5,454 Views)

hello

Can_Type is a String und  i want to store the pressed button with him

0 Kudos
Message 4 of 22
(5,444 Views)

hello

 

Can_Type is a String und  I want to store the pressed button with him.
I have used the first method but I get an error :
Systax Error:
Unexpected token : Step

 

I have already created Sequences eg CanxSequence, Can1Sequence and I would really like the calls with CallSequence , see below two picture.

 

 

Where can I create the Can_Typearray to use the second option
sorry for the question,I am a beginner in teststand

Download All
0 Kudos
Message 5 of 22
(5,438 Views)

sonnyanderson wrote:

Where can I create the Can_Typearray to use the second option


Just create a Local variable and populate it with the values you want.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 22
(5,434 Views)

sonnyanderson wrote:[...]
I have used the first method but I get an error :

Systax Error:
Unexpected token : Step


Obviously, there is an error in the expression. Are you sure that you placed the quotation marks (") correctly? You must not have quotation marks containing the whole expression, as this suppresses evaluation (as it is stated as a string!)

The expression is placed as POST expression of the MESSAGE POPUP step?

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 7 of 22
(5,426 Views)


Obviously, there is an error in the expression. Are you sure that you placed the quotation marks (") correctly? You must not have quotation marks containing the whole expression, as this suppresses evaluation (as it is stated as a string!)

The expression is placed as POST expression of the MESSAGE POPUP step?

Norbert


I JUST COPY PASTE THIS TIME CI, but STILL MY STEP RED

0 Kudos
Message 8 of 22
(5,392 Views)

Yes, you miss-typed "step" as "setp" (red marked in the expression)......

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 9 of 22
(5,383 Views)

Norbert_B a écrit :

Yes, you miss-typed "step" as "setp" (red marked in the expression)......

 

Norbert


there always wrong, but this time I'm typing

0 Kudos
Message 10 of 22
(5,377 Views)