Comparing dates in script

I don’t know what is wrong in my code

The last line doesn’t run.
Not sure if the if statements aren’t ending or what is going on

    today =
	dayBefore =, -1)
	shift3yesterday =, 23, 0, 0)
	shift1today =, 7, 0, 0)		
	shift2today =, 15, 0, 0)		
	shift3today =, 23, 0, 0)	
	if,shift1today) :
	if,shift1today,shift2today) :
	if,shift3today) :
	system.tag.writeBlocking(["[.]Current Shift Start"], [today])

These are case sensitive; you’re missing a capital in the middle of each function name.

I would expect an error like AttributeError: 'com.inductiveautomation.ignition.designer.gui.tool' object has no attribute 'isbefore' in the gateway log.

What are you trying to do with currentshiftstart? It doesn’t appear that you’re calling it.

initially I marked it as the solution

would that make the bottom line not run?

Yes. It stops in line 9. I pasted your code into the Script Console to test.

how do I get to use that

Tools -> Script Console


Thanks so much

1 Like