jhomer Posted May 30, 2008 Posted May 30, 2008 Im trying to run what I assumed was a simple If statement. I have a start date and end date and I'm creating records for all dates that are Mon-Fri, doing a check before each loop iteration based on the following: If[(not DayofWeek ($Date) = 1) or (not DayofWeek($Date) = 7)] then go ahead through the part of the loop that creates the daily record. If it fails that it goes to the part of the loop that increments $Date by 1 day. No matter what value DayofWeek ($Date) returns it fails that if statement and goes straight to incrementing $Date. I tried switching to a ≠ without the not and it will pass the if statement every time. Am i missing something here?
comment Posted May 30, 2008 Posted May 30, 2008 1. The not operator is evaluated before the = comparison. Instead of: not this = that use: not ( this = that ) which is the same as: this ≠ that 2. You are using 'or' where 'and' is required.
Recommended Posts
This topic is 6022 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now