11-09-2011 05:22 PM
Do While
((
Val(Locals.DailySelfCalTimeMsgBoxInputHours)<0&& Val(Locals.DailySelfCalTimeMsgBoxInputHours)>23))||((Val(Locals.DailySelfCalTimeMsgBoxInputMinutes)<0&& Val(Locals.DailySelfCalTimeMsgBoxInputMinutes)>59))|| RunState.Sequence.Main["Message Popup"].Result.ButtonHit!="2"
msg Box to read in user input time
}
I have this logic, but the do while loop is never exited. If I press the Cancel button, the do While loop is exited. However, Locals.DailySelfCalTimeMsgBoxInputHours or Locals.DailySelfCalTimeMsgBoxInputMinutes meet the above conditions in the Do While expression, the loop still never exits. As part of the Message Box Post Expression, I converted both the aforementioned string variables to numeric type and they display values as expected. So, I am not sure why when I try to use Val(String) in the Do While expression, the evaluation does not work as intended. Can someone shed any light on this problem?
Solved! Go to Solution.
11-10-2011 01:53 AM
By the way ButtonHit is a number
11-10-2011 08:52 AM
Ok, thanks. However, the other logic other than the Button Hit does not work. Can the Val function be used the way I have listed it?
11-10-2011 09:58 AM
Pseudo Code:
While
hours < 0 and hours > 23
Or
minutes < 0 and minutes > 59
Or
buttonhit <> 2
end while
OK. Hours will never be both negative and larger than 23. Minutes will never be both negative and greater than 59. buttonhit could be not 2. So, it looks like you will only ever get a true on buttonhit.
I think you either have you greater and less reversed, or you should replace your ANDs with ORs.
Good luck,
Bob Y.
11-10-2011 10:41 AM
Yes, thanks for laying out the way you did. I see my error.
However, I tried the following with hours having an input of anything less than 23, but the while loop is not exited.
do while { hours >23 or button hit !=2)
{
msg box
}
I am not sure what I am doing wrong.
11-10-2011 11:00 AM
Do While
(
Locals.DailySelfCalTimeMsgBoxInputHoursNumeric>23)||(RunState.Sequence.Main["Message Popup"].Result.ButtonHit!=2))
{
Msg Box}
Ok, the first condition Locals.DailySelfCalTimeMsgBoxInputHoursNumeric>23 by itself works and the same applies to the second condition. However, when I put them in the OR condition, only hitting the Cancel Button, the second button, works. The first condition somehow does not work. Can someone please help? I am not sure what I am missing here.
Thanks to everyone who have helped me so far.
11-11-2011 09:10 AM
I don't really see any problems with the logic but I do see that you are missing one open parenthesis. I think you should be getting a compile error (unless it is just a typographical error in your post). Assuming that it gets placed with the other open parenthesis at the beginning of the logic expression, I don't see what would cause it to not trigger.
Sorry,
Bob Y.
11-11-2011 10:16 AM
Thanks for the feedback. There is a typographical error in my post. An OR condition does not work for what I want to accomplish. I managed to get it to work with an AND condition. Thanks for your reply, though.