I have a for loop that has an if statement nested in it inside of a script. The for loop does not appear to be executing correctly, as the for loop iterates before trying to enter the if loop. This is in a script in a binding in Perspective.
Your if statements are not going to work as I’m guessing you intended.
If you want to test a value against 2 or more conditions you would have to check them all explicitly like this.
if x == 2 or x == 3 or x == 4:
# Do something
Your 1st if statement evaluates if dataData[rows][1] is equal to ‘10015531’ and then it evaluates your next item (‘10023468’) as a statement to see if it can be evaluated as True or not and does that for all of the remaining items.
In your case you may be able to do something like this to make it a little cleaner. I left out some of the conditions.
if dateData[rows][1] in ['10015531', '10023468', '10036077', '10026408', '10010805', '10033990', '10010888']:
# Do Something
is a conditional evaluation which will result in True in Python because ‘z’ is not False or None. The Pythonic way to determine if a given value is within a set of values is to use