Other Syntax Issues

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
sailor dude
Pro Scripter
Posts: 50
Joined: Fri Jan 20, 2006 10:43 pm

Other Syntax Issues

Post by sailor dude » Thu Dec 14, 2006 11:42 pm

This line of code does not run properly in if else endif statements due to the {((%SUB_CODE%"l")OR(%SUB_CODE%"p"))}

However if I run this code and change the functionality in the if else endif statements, it runs OK

If>{((%SUB_CODE%="l")OR(%SUB_CODE%="p"))}

Any ideas why?

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri Dec 15, 2006 1:43 am

Remove leading {((%SUB_CODE%"l")OR(%SUB_CODE%"p"))}
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Dec 15, 2006 8:33 am

Don't you mean:

If>{((%SUB_CODE% "l") AND (%SUB_CODE% "p"))}

i.e. SUB_CODE must be anything other than I or P?

Mixing not equals and OR is a common mistake. OR means either one of the conditions can be true. If SUB_CODE is "p" then the first condition is true. While the second is not true the entire expression is true because each part is ORd. If SUB_CODE is "l" then the first expression is not true but the second IS true, so the entire If resolves true. Using AND ensures that ALL expressions must be true. Therefore it works if SUB_CODE is "l" or "p".
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts