NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Structuring a Message Box

I am putting out a MessageBox which should have the following display HH (two digits for hours) : MM (two digits for minutes.  Can the message box string input be setup to only accept the data entry in this format?

0 Kudos
Message 1 of 5
(3,169 Views)

No, the message box step doesn't have that feature. You will have to validate the input after the step returns or create your own dialog.

 

If you think the message box step should support this, you can make a feature suggestion here: http://forums.ni.com/t5/NI-TestStand-Idea-Exchange/idb-p/teststandideas. 

0 Kudos
Message 2 of 5
(3,168 Views)

I came up with this post-expression in the Message Box:

Locals

.DailySelfCalTimeMsgBoxInputHours=Find((Left(Step.Result.Response,2)),":")?Left(Step.Result.Response,1😞Left(Step.Result.Response,2)

The logic that I am trying to implement here is to scan the first two strings of HH:MM time input and if a ":" is found, then only the first string is scanned for the hours.  If the string is not found, in case of a two-digit hour input, then the string gets the first two left characters of the time in HH:MM format.

However, the above code is not working as per the logic that I want.  Can someone please help?

0 Kudos
Message 3 of 5
(3,166 Views)

the problem with your expression is that the find is returning a -1 if it doesn't find the ":", which evaluates as true (since it is nonzero).  However, you could just get all the text before the colon using a simpler expression:

 

Locals.DailySelfCalTimeMsgBoxInputHours=Left(Step.Result.Response,Find(Step.Result.Response,":"))

 

Al B.
Staff Software Engineer - TestStand
CTA/CLD
0 Kudos
Message 4 of 5
(3,160 Views)

Thank you.  Yes, I simplified it outside a message box and now it works. 

0 Kudos
Message 5 of 5
(3,153 Views)