11-10-2011 02:24 PM
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?
11-10-2011 02:35 PM
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.
11-10-2011 03:12 PM
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?
11-11-2011 12:22 AM
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,":"))
11-11-2011 08:39 AM
Thank you. Yes, I simplified it outside a message box and now it works.