NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

message Popup Numerics Only

Hello All,

 

I am currently struggling to Error Trap an input to a Message Pop-Up to ensure it is only a numeric.

 

I am expecting a number to be entered, and then stored to a File.Globals as a Numeric (not a string). If the Operator was to enter nothing or a word, the routine does not work, and I am unsure how I would error trap an empty entry or characters that are not numbers (Numeric).

 

Could anyone be so kind to shed some light on this matter on how I would achieve this?

 

Many thanks in advance!

 

 

 

 

0 Kudos
Message 1 of 4
(3,917 Views)

 Did you think about using a loop ? Something like

Show messagePopup

Check input

Repeat this until input meets your conditions

 

0 Kudos
Message 2 of 4
(3,903 Views)

HI,

 

You need to use the function VAL(arg a,arg b)

 

It converts string argument a to a number ( this is because message popup will only take string).

Argument b tells if the a is a valid number.

 

In a statement step :

 

Locals.numtemp=Val("q",Locals.isvalid)   --- this will result in isvalid boolen as false and numtemp as 0

 

Locals.numtemp=Val("1",Locals.isvalid) -- numtemp will be 1 and isvalid will be true.

 

Hope this helps,

 

Ravi

Message 3 of 4
(3,898 Views)

Thanks Ravi,

 

It works a treat!

 

🙂

 

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