Look_Up Posted November 19, 2014 Report Share Posted November 19, 2014 Hello guys. I wrote a loop with OR but the condition is not true. Why ? Variable Set String %T[1]% to "2013"If Variable %T[1]% Does not Equal "2013" ORIf Variable %T[1]% Does not Equal "2014" MessageBox: InfoElse MessageBox: InfoEnd IfSource code: <VARIABLE SET STRING Option="\x00" Destination="%T[1]%" Value="2013" NoEmbeddedVars="FALSE"/> <IF VARIABLE Variable="%T[1]%" Condition="\x01" Value="2013" IgnoreCase="FALSE"/> <OR/> <IF VARIABLE Variable="%T[1]%" Condition="\x01" Value="2014" IgnoreCase="FALSE"/> <MESSAGEBOX Caption="Info" Message="Date is NOT 2013 or 2014" Icon="0"/> <ELSE/> <MESSAGEBOX Caption="Info" Message="Date is correct. Have a nice day." Icon="0"/> <END IF/> My hairs getting grey. Look_Up Quote Link to comment Share on other sites More sharing options...
rberq Posted November 19, 2014 Report Share Posted November 19, 2014 Change the OR to AND. You will be not unhappy. Quote Link to comment Share on other sites More sharing options...
Cory Posted November 19, 2014 Report Share Posted November 19, 2014 That's the funniest thing I've heard all day! Thanks for brightening my morning Rberq. Quote Link to comment Share on other sites More sharing options...
Look_Up Posted November 20, 2014 Author Report Share Posted November 20, 2014 (edited) Stan Jones from Macro Express Team answered me. It only works correct when i change "Does not Equal" to "Equal". Looks like it is a bug. BUT.... I came to the solution, when I finished my macro. "VARIABLE SET STRING" >> 2013 and 2014 are normally NOT string variable rather integer. Macro Express can only make a correct comparison when the correct variable type is given. Look_Up Edited November 20, 2014 by Look_Up Quote Link to comment Share on other sites More sharing options...
terrypin Posted December 3, 2014 Report Share Posted December 3, 2014 Just saw this thread today. You had no need to look beyond Bob's answer of 19th November! Didn't you try it? It's a common mistake. Your logic was flawed. ONE of those two conditions you specified was met: T1 was 2013, so it did not equal 2014. So you got the 'correct' message. It was just wrongly worded. Nothing to do with variable type. Also, are you sure you reported Stan's suggestion correctly? That obviously doesn't work either. --Terry, East Grinstead, UK Quote Link to comment Share on other sites More sharing options...
Look_Up Posted December 11, 2014 Author Report Share Posted December 11, 2014 Change the OR to AND. You will be not unhappy. [...] I came to the solution, when I finished my macro. "VARIABLE SET STRING" >> 2013 and 2014 are normally NOT string variable rather integer. Macro Express can only make a correct comparison when the correct variable type is given. [...] Hey Terry, i want answer you. Yes, I have a problem to getting thru with Boolean logic. rberg giving the correct answer AND 2013/2014 aren't string variable. So i change my macro and everything went right. Here is the answer from Stan: Hi, Variable Set String %T[1]% to "2013" If Variable %T[1]% Does not Equal "2013" OR If Variable %T[1]% Does not Equal "2014" MessageBox: Info The way this is written only one of the two If Variables needs to be true in order for the first message box to display. Since T1 does not equal 2014, the first message appears. I would suggest rewriting the macro to something similar to what is shown below. Also make sure to swap the message boxes. Variable Set String %T[1]% to "2013" If Variable %T[1]% Equals "2013" OR If Variable %T[1]% Equals "2014" MessageBox: Info (Date is correct. Have a nice day.) Else MessageBox: Info (Date is NOT 2013 or 2014) End If The above should work the way you want. Please let me know if you have any questions. Thanks, Stan Jones Insight Software Solutions, Inc. Thanks to all the people who helped me ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.