Why is there a red squiggly under the d in def valueChanged on tag script?


I have a feeling this is going to be a really simple fix, but I've been stumped for a few days now.

Please see the photo I have attached. Ignition is telling me I have an error with the def function. I'm not sure what this error means as it does not give me any insight when I hover over the red mark all the way to the right like normal. You also cannot edit a pre defined function like the one listed, so I'm not sure why there would be an error on something you cant edit and now it wont run the tag.

Is this an error with the script in the function? Any help with this would be greatly appreciated. Thank you!

Is there actual code in the function?

1 Like

Edited: to give a bit more detail.

Yes, there is. We have a tag like this for all lines in this project, so there are other lines that have this tag working (although the code is a bit different depending on the machines found on the line.)

The tag expression is equal to now() and the code pretty much looks at the lines Preventative Maintenance status and if the PM status in not selected and there is no "Green" value in the table (means check is completed) , it marks the value red meaning the check for that specific machine on this specific line was missed. A quick snap shot of the code can be found below:


My first guess is going to be an indentation error.

Screenshots are not too conducive to troubleshooting. Copy your code, including the def, if possible and post it here. Click the Preformatted Text button, then paste your code in. Then we can take a closer look for you. :slight_smile:

image
image

Ah I see. It is a very long script, over 1600* lines, however its extremely redundant. I have to post it in three* parts as I was well above the character limit when trying to post in one comment. However the code will be posted exactly as it is written.

Thank you in advance for all the help!

Lines 1-642

	#define the beginning of shift 1 and where 0(midnight) is 
	a = 6  
	b = a+1 
	c = b+1
	d = c+1
	e = d+1
	f = e+1
	g = f+1
	h = g+1 
	i = h+1
	j = i+1
	k = j+1
	l = k+1
	
	m = l+1
	n = m+1
	o = n+1
	p = o+1
	q = p+1
	r = q+1
	s = 0
	t = s+1
	u = t+1
	v = u+1
	w = v+1
	x = w+1 
	
#	min1 = 30
	
#	part = 	system.tag.read("[.]ShiftInfo").value.getValueAt(0,1)
	timeTag = currentValue.value
#	minuteTag = system.date.getMinute
	if system.tag.read("[.]PMStatus").value == 0:
		if system.date.getHour24(timeTag) == b:
			table = system.tag.read("[.]EveryHourShift1").value
#			if table.getValueAt(0,1) =="" and part =="16.9oz, 20.8g, Propel ":
#				newData1 = system.dataset.setValue(table, 0,1, "Red")
#				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(0,1) =="":
				newData1 = system.dataset.setValue(table, 0,1, "Red")
				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(1,1)== "":
				newData2 = system.dataset.setValue(table, 1,1, "Red")
				system.tag.write("[.]EveryHourShift1",newData2)
			if table.getValueAt(2,1) =="":
				newData3 = system.dataset.setValue(table, 2,1, "Red")
				system.tag.write("[.]EveryHourShift1",newData3)
			if table.getValueAt(3,1) =="":
				newData4 = system.dataset.setValue(table, 3,1, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(4,1) =="":
				newData4 = system.dataset.setValue(table, 4,1, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(5,1) =="":
				newData4 = system.dataset.setValue(table, 5,1, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(6,1) =="":
				newData4 = system.dataset.setValue(table, 6,1, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(7,1) =="":
				newData4 = system.dataset.setValue(table, 7,1, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(8,1) =="":
				newData4 = system.dataset.setValue(table, 8,1, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
#			table3 = system.tag.read("[.]EveryTwiceAnHourShift1").value
#			if minuteTag < 30:
#				if table3.getValueAt(0,1) =="":
#					newData1 = system.dataset.setValue(table, 0,1, "Red")
#					system.tag.write("[.]EveryTwiceAnHourShift1",newData1)
#			else:
#				if table3.getValueAt(0,1) =="":
#					newData1 = system.dataset.setValue(table, 0,1, "Red")
#					system.tag.write("[.]EveryTwiceAnHourShift1",newData1)
				
		elif system.date.getHour24(timeTag) == c:
			table = system.tag.read("[.]EveryHourShift1").value
#			if table.getValueAt(0,2) ==""and part =="16.9oz, 20.8g, Propel ":
#				newData1 = system.dataset.setValue(table, 0,2, "Red")
#				system.tag.write("[.]EveryHourShift1",newData1)
#			elif table.getValueAt(0,2) =="":
#				newData1 = system.dataset.setValue(table, 0,2, "Blue")
#				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(0,2)== "":
				newData1 = system.dataset.setValue(table, 0,2, "Red")
				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(1,2)== "":
				newData2 = system.dataset.setValue(table, 1,2, "Red")
				system.tag.write("[.]EveryHourShift1",newData2)
			if table.getValueAt(2,2) =="":
				newData3 = system.dataset.setValue(table, 2,2, "Red")
				system.tag.write("[.]EveryHourShift1",newData3)
			if table.getValueAt(3,2) =="":
				newData4 = system.dataset.setValue(table, 3,2, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(4,2) =="":
				newData4 = system.dataset.setValue(table, 4,2, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(5,2) =="":
				newData4 = system.dataset.setValue(table, 5,2, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(6,2) =="":
				newData4 = system.dataset.setValue(table, 6,2, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(7,2) =="":
				newData4 = system.dataset.setValue(table, 7,2, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(8,2) =="":
				newData4 = system.dataset.setValue(table, 8,2, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			table2 = system.tag.read("[.]Every2HourShift1").value
			if table2.getValueAt(0,1) =="":
				twoData1 = system.dataset.setValue(table2, 0,1, "Red")
				system.tag.write("[.]Every2HourShift1",twoData1)
			if table2.getValueAt(1,1) =="":
				twoData1 = system.dataset.setValue(table2, 1,1, "Red")
				system.tag.write("[.]Every2HourShift1",twoData1)
		elif system.date.getHour24(timeTag) == d:
			table = system.tag.read("[.]EveryHourShift1").value
#			if table.getValueAt(0,3) ==""and part =="16.9oz, 20.8g, Propel ":
#				newData1 = system.dataset.setValue(table, 0,3, "Red")
#				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(0,3) =="":
				newData1 = system.dataset.setValue(table, 0,3, "Red")
				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(1,3)== "":
				newData2 = system.dataset.setValue(table, 1,3, "Red")
				system.tag.write("[.]EveryHourShift1",newData2)
			if table.getValueAt(2,3) =="":
				newData3 = system.dataset.setValue(table, 2,3, "Red")
				system.tag.write("[.]EveryHourShift1",newData3)
			if table.getValueAt(3,3) =="":
				newData4 = system.dataset.setValue(table, 3,3, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(4,3) =="":
				newData4 = system.dataset.setValue(table, 4,3, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(5,3) =="":
				newData4 = system.dataset.setValue(table, 5,3, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(6,3) =="":
				newData4 = system.dataset.setValue(table, 6,3, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(7,3) =="":
				newData4 = system.dataset.setValue(table, 7,3, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(8,3) =="":
				newData4 = system.dataset.setValue(table, 8,3, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
		elif system.date.getHour24(timeTag) == e:
			table = system.tag.read("[.]EveryHourShift1").value
#			if table.getValueAt(0,4) ==""and part =="16.9oz, 20.8g, Propel ":
#				newData1 = system.dataset.setValue(table, 0,4, "Red")
#				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(0,4) =="":
				newData1 = system.dataset.setValue(table, 0,4, "Red")
				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(1,4)== "":
				newData2 = system.dataset.setValue(table, 1,4, "Red")
				system.tag.write("[.]EveryHourShift1",newData2)
			if table.getValueAt(2,4) =="":
				newData3 = system.dataset.setValue(table, 2,4, "Red")
				system.tag.write("[.]EveryHourShift1",newData3)
			if table.getValueAt(3,4) =="":
				newData4 = system.dataset.setValue(table, 3,4, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(4,4) =="":
				newData4 = system.dataset.setValue(table, 4,4, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(5,4) =="":
				newData4 = system.dataset.setValue(table, 5,4, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(6,4) =="":
				newData4 = system.dataset.setValue(table, 6,4, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(7,4) =="":
				newData4 = system.dataset.setValue(table, 7,4, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(8,4) =="":
				newData4 = system.dataset.setValue(table, 8,4, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			table2 = system.tag.read("[.]Every2HourShift1").value
			if table2.getValueAt(0,2) =="":
				twoData1 = system.dataset.setValue(table2, 0,2, "Red")
				system.tag.write("[.]Every2HourShift1",twoData1)
			if table2.getValueAt(1,2) =="":
				twoData1 = system.dataset.setValue(table2, 1,2, "Red")
				system.tag.write("[.]Every2HourShift1",twoData1)
		elif system.date.getHour24(timeTag) == f:
			table = system.tag.read("[.]EveryHourShift1").value
#			if table.getValueAt(0,5) =="" and part =="16.9oz, 20.8g, Propel ":
#				newData1 = system.dataset.setValue(table, 0,5, "Red")
#				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(0,5) =="":
				newData1 = system.dataset.setValue(table, 0,5, "Red")
				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(1,5)== "":
				newData2 = system.dataset.setValue(table, 1,5, "Red")
				system.tag.write("[.]EveryHourShift1",newData2)
			if table.getValueAt(2,5) =="":
				newData3 = system.dataset.setValue(table, 2,5, "Red")
				system.tag.write("[.]EveryHourShift1",newData3)
			if table.getValueAt(3,5) =="":
				newData4 = system.dataset.setValue(table, 3,5, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(4,5) =="":
				newData4 = system.dataset.setValue(table, 4,5, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(5,5) =="":
				newData4 = system.dataset.setValue(table, 5,5, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(6,5) =="":
				newData4 = system.dataset.setValue(table, 6,5, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(7,5) =="":
				newData4 = system.dataset.setValue(table, 7,5, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(8,5) =="":
				newData4 = system.dataset.setValue(table, 8,5, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			
		elif system.date.getHour24(timeTag) == g:
			table = system.tag.read("[.]EveryHourShift1").value
#			if table.getValueAt(0,6) ==""and part =="16.9oz, 20.8g, Propel ":
#				newData1 = system.dataset.setValue(table, 0,6, "Red")
#				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(0,6) =="":
				newData1 = system.dataset.setValue(table, 0,6, "Red")
				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(1,6)== "":
				newData2 = system.dataset.setValue(table, 1,6, "Red")
				system.tag.write("[.]EveryHourShift1",newData2)
			if table.getValueAt(2,6) =="":
				newData3 = system.dataset.setValue(table, 2,6, "Red")
				system.tag.write("[.]EveryHourShift1",newData3)
			if table.getValueAt(3,6) =="":
				newData4 = system.dataset.setValue(table, 3,6, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(4,6) =="":
				newData4 = system.dataset.setValue(table, 4,6, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(5,6) =="":
				newData4 = system.dataset.setValue(table, 5,6, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(6,6) =="":
				newData4 = system.dataset.setValue(table, 6,6, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(7,6) =="":
				newData4 = system.dataset.setValue(table, 7,6, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(8,6) =="":
				newData4 = system.dataset.setValue(table, 8,6, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			table2 = system.tag.read("[.]Every2HourShift1").value
			if table2.getValueAt(0,3) =="":
				twoData1 = system.dataset.setValue(table2, 0,3, "Red")
				system.tag.write("[.]Every2HourShift1",twoData1)
			if table2.getValueAt(1,3) =="":
				twoData1 = system.dataset.setValue(table2, 1,3, "Red")
				system.tag.write("[.]Every2HourShift1",twoData1)
		elif system.date.getHour24(timeTag) == h:
			table = system.tag.read("[.]EveryHourShift1").value
#			if table.getValueAt(0,7) ==""and part =="16.9oz, 20.8g, Propel ":
#				newData1 = system.dataset.setValue(table, 0,7, "Red")
#				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(0,7) =="":
				newData1 = system.dataset.setValue(table, 0,7, "Red")
				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(1,7)== "":
				newData2 = system.dataset.setValue(table, 1,7, "Red")
				system.tag.write("[.]EveryHourShift1",newData2)
			if table.getValueAt(2,7) =="":
				newData3 = system.dataset.setValue(table, 2,7, "Red")
				system.tag.write("[.]EveryHourShift1",newData3)
			if table.getValueAt(3,7) =="":
				newData4 = system.dataset.setValue(table, 3,7, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(4,7) =="":
				newData4 = system.dataset.setValue(table, 4,7, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(5,7) =="":
				newData4 = system.dataset.setValue(table, 5,7, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(6,7) =="":
				newData4 = system.dataset.setValue(table, 6,7, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(7,7) =="":
				newData4 = system.dataset.setValue(table, 7,7, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(8,7) =="":
				newData4 = system.dataset.setValue(table, 8,7, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
		elif system.date.getHour24(timeTag) == i:
			table = system.tag.read("[.]EveryHourShift1").value
#			if table.getValueAt(0,8) ==""and part =="16.9oz, 20.8g, Propel ":
#				newData1 = system.dataset.setValue(table, 0,8, "Red")
#				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(0,8) =="":
				newData1 = system.dataset.setValue(table, 0,8, "Red")
				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(1,8)== "":
				newData2 = system.dataset.setValue(table, 1,8, "Red")
				system.tag.write("[.]EveryHourShift1",newData2)
			if table.getValueAt(2,8) =="":
				newData3 = system.dataset.setValue(table, 2,8, "Red")
				system.tag.write("[.]EveryHourShift1",newData3)
			if table.getValueAt(3,8) =="":
				newData4 = system.dataset.setValue(table, 3,8, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(4,8) =="":
				newData4 = system.dataset.setValue(table, 4,8, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(5,8) =="":
				newData4 = system.dataset.setValue(table, 5,8, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(6,8) =="":
				newData4 = system.dataset.setValue(table, 6,8, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(7,8) =="":
				newData4 = system.dataset.setValue(table, 7,8, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(8,8) =="":
				newData4 = system.dataset.setValue(table, 8,8, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			table2 = system.tag.read("[.]Every2HourShift1").value
			if table2.getValueAt(0,4) =="":
				twoData1 = system.dataset.setValue(table2, 0,4, "Red")
				system.tag.write("[.]Every2HourShift1",twoData1)
			if table2.getValueAt(1,4) =="":
				twoData1 = system.dataset.setValue(table2, 1,4, "Red")
				system.tag.write("[.]Every2HourShift1",twoData1)
		elif system.date.getHour24(timeTag) == j:
			table = system.tag.read("[.]EveryHourShift1").value
#			if table.getValueAt(0,9) ==""and part =="16.9oz, 20.8g, Propel ":
#				newData1 = system.dataset.setValue(table, 0,9, "Red")
#				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(0,9) =="":
				newData1 = system.dataset.setValue(table, 0,9, "Red")
				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(1,9)== "":
				newData2 = system.dataset.setValue(table, 1,9, "Red")
				system.tag.write("[.]EveryHourShift1",newData2)
			if table.getValueAt(2,9) =="":
				newData3 = system.dataset.setValue(table, 2,9, "Red")
				system.tag.write("[.]EveryHourShift1",newData3)
			if table.getValueAt(3,9) =="":
				newData4 = system.dataset.setValue(table, 3,9, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(4,9) =="":
				newData4 = system.dataset.setValue(table, 4,9, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(5,9) =="":
				newData4 = system.dataset.setValue(table, 5,9, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(6,9) =="":
				newData4 = system.dataset.setValue(table, 6,9, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(7,9) =="":
				newData4 = system.dataset.setValue(table, 7,9, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(8,9) =="":
				newData4 = system.dataset.setValue(table, 8,9, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
		elif system.date.getHour24(timeTag) == k:
			table = system.tag.read("[.]EveryHourShift1").value
#			if table.getValueAt(0,10) ==""and part =="16.9oz, 20.8g, Propel ":
#				newData1 = system.dataset.setValue(table, 0,10, "Red")
#				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(0,10) =="":
				newData1 = system.dataset.setValue(table, 0,10, "Red")
				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(1,10)== "":
				newData2 = system.dataset.setValue(table, 1,10, "Red")
				system.tag.write("[.]EveryHourShift1",newData2)
			if table.getValueAt(2,10) =="":
				newData3 = system.dataset.setValue(table, 2,10, "Red")
				system.tag.write("[.]EveryHourShift1",newData3)
			if table.getValueAt(3,10) =="":
				newData4 = system.dataset.setValue(table, 3,10, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(4,10) =="":
				newData4 = system.dataset.setValue(table, 4,10, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(5,10) =="":
				newData4 = system.dataset.setValue(table, 5,10, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(6,10) =="":
				newData4 = system.dataset.setValue(table, 6,10, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(7,10) =="":
				newData4 = system.dataset.setValue(table, 7,10, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(8,10) =="":
				newData4 = system.dataset.setValue(table, 8,10, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			table2 = system.tag.read("[.]Every2HourShift1").value
			if table2.getValueAt(0,5) =="":
				twoData1 = system.dataset.setValue(table2, 0,5, "Red")
				system.tag.write("[.]Every2HourShift1",twoData1)
			if table2.getValueAt(1,5) =="":
				twoData1 = system.dataset.setValue(table2, 1,5, "Red")
				system.tag.write("[.]Every2HourShift1",twoData1)
		elif system.date.getHour24(timeTag) == l:
			table = system.tag.read("[.]EveryHourShift1").value
#			if table.getValueAt(0,11) ==""and part =="16.9oz, 20.8g, Propel ":
#				newData1 = system.dataset.setValue(table, 0,11, "Red")
#				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(0,11) =="":
				newData1 = system.dataset.setValue(table, 0,11, "Red")
				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(1,11)== "":
				newData2 = system.dataset.setValue(table, 1,11, "Red")
				system.tag.write("[.]EveryHourShift1",newData2)
			if table.getValueAt(2,11) =="":
				newData3 = system.dataset.setValue(table, 2,11, "Red")
				system.tag.write("[.]EveryHourShift1",newData3)
			if table.getValueAt(3,11) =="":
				newData4 = system.dataset.setValue(table, 3,11, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(4,11) =="":
				newData4 = system.dataset.setValue(table, 4,11, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(5,11) =="":
				newData4 = system.dataset.setValue(table, 5,11, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(6,11) =="":
				newData4 = system.dataset.setValue(table, 6,11, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(7,11) =="":
				newData4 = system.dataset.setValue(table, 7,11, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(8,11) =="":
				newData4 = system.dataset.setValue(table, 8,11, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
		elif system.date.getHour24(timeTag) == m:
			table = system.tag.read("[.]EveryHourShift1").value
#			if table.getValueAt(0,12) ==""and part =="16.9oz, 20.8g, Propel ":
#				newData1 = system.dataset.setValue(table, 0,12, "Red")
#				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(0,12) =="":
				newData1 = system.dataset.setValue(table, 0,12, "Red")
				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(1,12)== "":
				newData2 = system.dataset.setValue(table, 1,12, "Red")
				system.tag.write("[.]EveryHourShift1",newData2)
			if table.getValueAt(2,12) =="":
				newData3 = system.dataset.setValue(table, 2,12, "Red")
				system.tag.write("[.]EveryHourShift1",newData3)
			if table.getValueAt(3,12) =="":
				newData4 = system.dataset.setValue(table, 3,12, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(4,12) =="":
				newData4 = system.dataset.setValue(table, 4,12, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(5,12) =="":
				newData4 = system.dataset.setValue(table, 5,12, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(6,12) =="":
				newData4 = system.dataset.setValue(table, 6,12, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(7,12) =="":
				newData4 = system.dataset.setValue(table, 7,12, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(8,12) =="":
				newData4 = system.dataset.setValue(table, 8,12, "Red")
				system.tag.write("[.]EveryHourShift1",newData4)

		elif system.date.getHour24(timeTag) ==n:
			table = system.tag.read("[.]EveryHourShift2").value
#			if table.getValueAt(0,1) ==""and part =="16.9oz, 20.8g, Propel ":
#				newData1 = system.dataset.setValue(table, 0,1, "Red")
#				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(0,1)== "":
				newData1 = system.dataset.setValue(table, 0,1, "Red")
				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(1,1)== "":
				newData2 = system.dataset.setValue(table, 1,1, "Red")
				system.tag.write("[.]EveryHourShift2",newData2)
			if table.getValueAt(2,1) =="":
				newData3 = system.dataset.setValue(table, 2,1, "Red")
				system.tag.write("[.]EveryHourShift2",newData3)
			if table.getValueAt(3,1) =="":
				newData4 = system.dataset.setValue(table, 3,1, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(4,1) =="":
				newData4 = system.dataset.setValue(table, 4,1, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(5,1) =="":
				newData4 = system.dataset.setValue(table, 5,1, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(6,1) =="":
				newData4 = system.dataset.setValue(table, 6,1, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(7,1) =="":
				newData4 = system.dataset.setValue(table, 7,1, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(8,1) =="":
				newData4 = system.dataset.setValue(table, 8,1, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
		elif system.date.getHour24(timeTag) == o:
			table = system.tag.read("[.]EveryHourShift2").value
#			if table.getValueAt(0,2) ==""and part =="16.9oz, 20.8g, Propel ":
#				newData1 = system.dataset.setValue(table, 0,2, "Red")
#				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(0,2)== "":
				newData1 = system.dataset.setValue(table, 0,2, "Red")
				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(1,2)== "":
				newData2 = system.dataset.setValue(table, 1,2, "Red")
				system.tag.write("[.]EveryHourShift2",newData2)
			if table.getValueAt(2,2) =="":
				newData3 = system.dataset.setValue(table, 2,2, "Red")
				system.tag.write("[.]EveryHourShift2",newData3)
			if table.getValueAt(3,2) =="":
				newData4 = system.dataset.setValue(table, 3,2, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(4,2) =="":
				newData4 = system.dataset.setValue(table, 4,2, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(5,2) =="":
				newData4 = system.dataset.setValue(table, 5,2, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(6,2) =="":
				newData4 = system.dataset.setValue(table, 6,2, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(7,2) =="":
				newData4 = system.dataset.setValue(table, 7,2, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(8,2) =="":
				newData4 = system.dataset.setValue(table, 8,2, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			table2 = system.tag.read("[.]Every2HourShift2").value
			if table2.getValueAt(0,1) =="":
				twoData1 = system.dataset.setValue(table2, 0,1, "Red")
				system.tag.write("[.]Every2HourShift2",twoData1)
			if table2.getValueAt(1,1) =="":
				twoData1 = system.dataset.setValue(table2, 1,1, "Red")
				system.tag.write("[.]Every2HourShift2",twoData1)
		elif system.date.getHour24(timeTag) == p:
			table = system.tag.read("[.]EveryHourShift2").value
#			if table.getValueAt(0,3) ==""and part =="16.9oz, 20.8g, Propel ":
#				newData1 = system.dataset.setValue(table, 0,3, "Red")
#				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(0,3)== "":
				newData1 = system.dataset.setValue(table, 0,3, "Red")
				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(1,3)== "":
				newData2 = system.dataset.setValue(table, 1,3, "Red")
				system.tag.write("[.]EveryHourShift2",newData2)
			if table.getValueAt(2,3) =="":
				newData3 = system.dataset.setValue(table, 2,3, "Red")
				system.tag.write("[.]EveryHourShift2",newData3)
			if table.getValueAt(3,3) =="":
				newData4 = system.dataset.setValue(table, 3,3, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(4,3) =="":
				newData4 = system.dataset.setValue(table, 4,3, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(5,3) =="":
				newData4 = system.dataset.setValue(table, 5,3, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(6,3) =="":
				newData4 = system.dataset.setValue(table, 6,3, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(7,3) =="":
				newData4 = system.dataset.setValue(table, 7,3, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(8,3) =="":
				newData4 = system.dataset.setValue(table, 8,3, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
		elif system.date.getHour24(timeTag) == q:
			table = system.tag.read("[.]EveryHourShift2").value
#			if table.getValueAt(0,4) ==""and part =="16.9oz, 20.8g, Propel ":
#				newData1 = system.dataset.setValue(table, 0,4, "Red")
#				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(0,4)== "":
				newData1 = system.dataset.setValue(table, 0,4, "Red")
				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(1,4)== "":
				newData2 = system.dataset.setValue(table, 1,4, "Red")
				system.tag.write("[.]EveryHourShift2",newData2)
			if table.getValueAt(2,4) =="":
				newData3 = system.dataset.setValue(table, 2,4, "Red")
				system.tag.write("[.]EveryHourShift2",newData3)
			if table.getValueAt(3,4) =="":
				newData4 = system.dataset.setValue(table, 3,4, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(4,4) =="":
				newData4 = system.dataset.setValue(table, 4,4, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(5,4) =="":
				newData4 = system.dataset.setValue(table, 5,4, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(6,4) =="":
				newData4 = system.dataset.setValue(table, 6,4, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(7,4) =="":
				newData4 = system.dataset.setValue(table, 7,4, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(8,4) =="":
				newData4 = system.dataset.setValue(table, 8,4, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			table2 = system.tag.read("[.]Every2HourShift2").value
			if table2.getValueAt(0,2) =="":
				twoData1 = system.dataset.setValue(table2, 0,2, "Red")
				system.tag.write("[.]Every2HourShift2",twoData1)
			if table2.getValueAt(1,2) =="":
				twoData1 = system.dataset.setValue(table2, 1,2, "Red")
				system.tag.write("[.]Every2HourShift2",twoData1)
		elif system.date.getHour24(timeTag) == r:
			table = system.tag.read("[.]EveryHourShift2").value
#			if table.getValueAt(0,5) ==""and part =="16.9oz, 20.8g, Propel ":
#				newData1 = system.dataset.setValue(table, 0,5, "Red")
#				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(0,5)== "":
				newData1 = system.dataset.setValue(table, 0,5, "Red")
				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(1,5)== "":
				newData2 = system.dataset.setValue(table, 1,5, "Red")
				system.tag.write("[.]EveryHourShift2",newData2)
			if table.getValueAt(2,5) =="":
				newData3 = system.dataset.setValue(table, 2,5, "Red")
				system.tag.write("[.]EveryHourShift2",newData3)
			if table.getValueAt(3,5) =="":
				newData4 = system.dataset.setValue(table, 3,5, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(4,5) =="":
				newData4 = system.dataset.setValue(table, 4,5, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(5,5) =="":
				newData4 = system.dataset.setValue(table, 5,5, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(6,5) =="":
				newData4 = system.dataset.setValue(table, 6,5, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(7,5) =="":
				newData4 = system.dataset.setValue(table, 7,5, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(8,5) =="":
				newData4 = system.dataset.setValue(table, 8,5, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)

Line 643 to 1243

		elif system.date.getHour24(timeTag) == s:
			table = system.tag.read("[.]EveryHourShift2").value
#			if table.getValueAt(0,6) ==""and part =="16.9oz, 20.8g, Propel ":
#				newData1 = system.dataset.setValue(table, 0,6, "Red")
#				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(0,6)== "":
				newData1 = system.dataset.setValue(table, 0,6, "Red")
				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(1,6)== "":
				newData2 = system.dataset.setValue(table, 1,6, "Red")
				system.tag.write("[.]EveryHourShift2",newData2)
			if table.getValueAt(2,6) =="":
				newData3 = system.dataset.setValue(table, 2,6, "Red")
				system.tag.write("[.]EveryHourShift2",newData3)
			if table.getValueAt(3,6) =="":
				newData4 = system.dataset.setValue(table, 3,6, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(4,6) =="":
				newData4 = system.dataset.setValue(table,4,6, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(5,6) =="":
				newData4 = system.dataset.setValue(table,5,6, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(6,6) =="":
				newData4 = system.dataset.setValue(table, 6,6, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(7,6) =="":
				newData4 = system.dataset.setValue(table, 7,6, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(8,6) =="":
				newData4 = system.dataset.setValue(table, 8,6, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			table2 = system.tag.read("[.]Every2HourShift2").value
			if table2.getValueAt(0,3) =="":
				twoData1 = system.dataset.setValue(table2, 0,3, "Red")
				system.tag.write("[.]Every2HourShift2",twoData1)
			if table2.getValueAt(1,3) =="":
				twoData1 = system.dataset.setValue(table2, 1,3, "Red")
				system.tag.write("[.]Every2HourShift2",twoData1)
		elif system.date.getHour24(timeTag) == t:
			table = system.tag.read("[.]EveryHourShift2").value
#			if table.getValueAt(0,7) ==""and part =="16.9oz, 20.8g, Propel ":
#				newData1 = system.dataset.setValue(table, 0,7, "Red")
#				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(0,7)== "":
				newData1 = system.dataset.setValue(table, 0,7, "Red")
				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(1,7)== "":
				newData2 = system.dataset.setValue(table, 1,7, "Red")
				system.tag.write("[.]EveryHourShift2",newData2)
			if table.getValueAt(2,7) =="":
				newData3 = system.dataset.setValue(table, 2,7, "Red")
				system.tag.write("[.]EveryHourShift2",newData3)
			if table.getValueAt(3,7) =="":
				newData4 = system.dataset.setValue(table, 3,7, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(4,7) =="":
				newData4 = system.dataset.setValue(table, 4,7, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(5,7) =="":
				newData4 = system.dataset.setValue(table, 5,7, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(6,7) =="":
				newData4 = system.dataset.setValue(table, 6,7, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(7,7) =="":
				newData4 = system.dataset.setValue(table, 7,7, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(8,7) =="":
				newData4 = system.dataset.setValue(table, 8,7, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
		elif system.date.getHour24(timeTag) == u:
			table = system.tag.read("[.]EveryHourShift2").value
#			if table.getValueAt(0,8) ==""and part =="16.9oz, 20.8g, Propel ":
#				newData1 = system.dataset.setValue(table, 0,8, "Red")
#				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(0,8)== "":
				newData1 = system.dataset.setValue(table, 0,8, "Red")
				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(1,8)== "":
				newData2 = system.dataset.setValue(table, 1,8, "Red")
				system.tag.write("[.]EveryHourShift2",newData2)
			if table.getValueAt(2,8) =="":
				newData3 = system.dataset.setValue(table, 2,8, "Red")
				system.tag.write("[.]EveryHourShift2",newData3)
			if table.getValueAt(3,8) =="":
				newData4 = system.dataset.setValue(table, 3,8, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(4,8) =="":
				newData4 = system.dataset.setValue(table, 4,8, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(5,8) =="":
				newData4 = system.dataset.setValue(table, 5,8, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(6,8) =="":
				newData4 = system.dataset.setValue(table, 6,8, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(7,8) =="":
				newData4 = system.dataset.setValue(table, 7,8, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(8,8) =="":
				newData4 = system.dataset.setValue(table, 8,8, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			table2 = system.tag.read("[.]Every2HourShift2").value
			if table2.getValueAt(0,4) =="":
				twoData1 = system.dataset.setValue(table2, 0,4, "Red")
				system.tag.write("[.]Every2HourShift2",twoData1)
			if table2.getValueAt(1,4) =="":
				twoData1 = system.dataset.setValue(table2, 1,4, "Red")
				system.tag.write("[.]Every2HourShift2",twoData1)
		elif system.date.getHour24(timeTag) == v:
			table = system.tag.read("[.]EveryHourShift2").value
#			if table.getValueAt(0,9) ==""and part =="16.9oz, 20.8g, Propel ":
#				newData1 = system.dataset.setValue(table, 0,9, "Red")
#				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(0,9)== "":
				newData1 = system.dataset.setValue(table, 0,9, "Red")
				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(1,9)== "":
				newData2 = system.dataset.setValue(table, 1,9, "Red")
				system.tag.write("[.]EveryHourShift2",newData2)
			if table.getValueAt(2,9) =="":
				newData3 = system.dataset.setValue(table, 2,9, "Red")
				system.tag.write("[.]EveryHourShift2",newData3)
			if table.getValueAt(3,9) =="":
				newData4 = system.dataset.setValue(table, 3,9, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(4,9) =="":
				newData4 = system.dataset.setValue(table, 4,9, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(5,9) =="":
				newData4 = system.dataset.setValue(table, 5,9, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(6,9) =="":
				newData4 = system.dataset.setValue(table, 6,9, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(7,9) =="":
				newData4 = system.dataset.setValue(table, 7,9, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(8,9) =="":
				newData4 = system.dataset.setValue(table, 8,9, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
		elif system.date.getHour24(timeTag) == w:
			table = system.tag.read("[.]EveryHourShift2").value
#			if table.getValueAt(0,10) ==""and part =="16.9oz, 20.8g, Propel ":
#				newData1 = system.dataset.setValue(table, 0,10, "Red")
#				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(0,10)== "":
				newData1 = system.dataset.setValue(table, 0,10, "Red")
				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(1,10)== "":
				newData2 = system.dataset.setValue(table, 1,10, "Red")
				system.tag.write("[.]EveryHourShift2",newData2)
			if table.getValueAt(2,10) =="":
				newData3 = system.dataset.setValue(table, 2,10, "Red")
				system.tag.write("[.]EveryHourShift2",newData3)
			if table.getValueAt(3,10) =="":
				newData4 = system.dataset.setValue(table, 3,10, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(4,10) =="":
				newData4 = system.dataset.setValue(table, 4,10, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(5,10) =="":
				newData4 = system.dataset.setValue(table, 5,10, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(6,10) =="":
				newData4 = system.dataset.setValue(table, 6,10, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(7,10) =="":
				newData4 = system.dataset.setValue(table, 7,10, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(8,10) =="":
				newData4 = system.dataset.setValue(table, 8,10, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			table2 = system.tag.read("[.]Every2HourShift2").value
			if table2.getValueAt(0,5) =="":
				twoData1 = system.dataset.setValue(table2, 0,5, "Red")
				system.tag.write("[.]Every2HourShift2",twoData1)
			if table2.getValueAt(1,5) =="":
				twoData1 = system.dataset.setValue(table2, 1,5, "Red")
				system.tag.write("[.]Every2HourShift2",twoData1)
		elif system.date.getHour24(timeTag) == x:
			table = system.tag.read("[.]EveryHourShift2").value
#			if table.getValueAt(0,11) ==""and part =="16.9oz, 20.8g, Propel ":
#				newData1 = system.dataset.setValue(table, 0,11, "Red")
#				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(0,11)== "":
				newData1 = system.dataset.setValue(table, 0,11, "Red")
				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(1,11)== "":
				newData2 = system.dataset.setValue(table, 1,11, "Red")
				system.tag.write("[.]EveryHourShift2",newData2)
			if table.getValueAt(2,11) =="":
				newData3 = system.dataset.setValue(table, 2,11, "Red")
				system.tag.write("[.]EveryHourShift2",newData3)
			if table.getValueAt(3,11) =="":
				newData4 = system.dataset.setValue(table, 3,11, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(4,11) =="":
				newData4 = system.dataset.setValue(table, 4,11, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(5,11) =="":
				newData4 = system.dataset.setValue(table, 5,11, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(6,11) =="":
				newData4 = system.dataset.setValue(table, 6,11, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(7,11) =="":
				newData4 = system.dataset.setValue(table, 7,11, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(8,11) =="":
				newData4 = system.dataset.setValue(table, 8,11, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
		elif system.date.getHour24(timeTag) == a:
			table = system.tag.read("[.]EveryHourShift2").value
#			if table.getValueAt(0,12) ==""and part =="16.9oz, 20.8g, Propel ":
#				newData1 = system.dataset.setValue(table, 0,12, "Red")
#				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(0,12)== "":
				newData1 = system.dataset.setValue(table, 0,12, "Red")
				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(1,12)== "":
				newData2 = system.dataset.setValue(table, 1,12, "Red")
				system.tag.write("[.]EveryHourShift2",newData2)
			if table.getValueAt(2,12) =="":
				newData3 = system.dataset.setValue(table, 2,12, "Red")
				system.tag.write("[.]EveryHourShift2",newData3)
			if table.getValueAt(3,12) =="":
				newData4 = system.dataset.setValue(table, 3,12, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(4,12) =="":
				newData4 = system.dataset.setValue(table, 4,12, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(5,12) =="":
				newData4 = system.dataset.setValue(table, 5,12, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(6,12) =="":
				newData4 = system.dataset.setValue(table, 6,12, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(7,12) =="":
				newData4 = system.dataset.setValue(table, 7,12, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(8,12) =="":
				newData4 = system.dataset.setValue(table, 8,12, "Red")
				system.tag.write("[.]EveryHourShift2",newData4)
	else:
		if system.date.getHour24(timeTag) == b:
			table = system.tag.read("[.]EveryHourShift1").value
			if table.getValueAt(0,1) =="":
				newData1 = system.dataset.setValue(table, 0,1, "Blue")
				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(1,1)== "":
				newData2 = system.dataset.setValue(table, 1,1, "Blue")
				system.tag.write("[.]EveryHourShift1",newData2)
			if table.getValueAt(2,1) =="":
				newData3 = system.dataset.setValue(table, 2,1, "Blue")
				system.tag.write("[.]EveryHourShift1",newData3)
			if table.getValueAt(3,1) =="":
				newData4 = system.dataset.setValue(table, 3,1, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(4,1) =="":
				newData4 = system.dataset.setValue(table, 4,1, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(5,1) =="":
				newData4 = system.dataset.setValue(table, 5,1, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(6,1) =="":
				newData4 = system.dataset.setValue(table, 6,1, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(7,1) =="":
				newData4 = system.dataset.setValue(table, 7,1, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(8,1) =="":
				newData4 = system.dataset.setValue(table, 8,1, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
		elif system.date.getHour24(timeTag) == c:
			table = system.tag.read("[.]EveryHourShift1").value
			if table.getValueAt(0,2) =="":
				newData1 = system.dataset.setValue(table, 0,2, "Blue")
				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(1,2)== "":
				newData2 = system.dataset.setValue(table, 1,2, "Blue")
				system.tag.write("[.]EveryHourShift1",newData2)
			if table.getValueAt(2,2) =="":
				newData3 = system.dataset.setValue(table, 2,2, "Blue")
				system.tag.write("[.]EveryHourShift1",newData3)
			if table.getValueAt(3,2) =="":
				newData4 = system.dataset.setValue(table, 3,2, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(4,2) =="":
				newData4 = system.dataset.setValue(table, 4,2, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(5,2) =="":
				newData4 = system.dataset.setValue(table, 5,2, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(6,2) =="":
				newData4 = system.dataset.setValue(table, 6,2, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(7,2) =="":
				newData4 = system.dataset.setValue(table, 7,2, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(8,2) =="":
				newData4 = system.dataset.setValue(table, 8,2, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			table2 = system.tag.read("[.]Every2HourShift1").value
			if table2.getValueAt(0,1) =="":
				twoData1 = system.dataset.setValue(table2, 0,1, "Blue")
				system.tag.write("[.]Every2HourShift1",twoData1)
			if table2.getValueAt(1,1) =="":
				twoData1 = system.dataset.setValue(table2, 1,1, "Blue")
				system.tag.write("[.]Every2HourShift1",twoData1)
		elif system.date.getHour24(timeTag) == d:
			table = system.tag.read("[.]EveryHourShift1").value
			if table.getValueAt(0,3) =="":
				newData1 = system.dataset.setValue(table, 0,3, "Blue")
				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(1,3)== "":
				newData2 = system.dataset.setValue(table, 1,3, "Blue")
				system.tag.write("[.]EveryHourShift1",newData2)
			if table.getValueAt(2,3) =="":
				newData3 = system.dataset.setValue(table, 2,3, "Blue")
				system.tag.write("[.]EveryHourShift1",newData3)
			if table.getValueAt(3,3) =="":
				newData4 = system.dataset.setValue(table, 3,3, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(4,3) =="":
				newData4 = system.dataset.setValue(table, 4,3, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(5,3) =="":
				newData4 = system.dataset.setValue(table, 5,3, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(6,3) =="":
				newData4 = system.dataset.setValue(table, 6,3, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(7,3) =="":
				newData4 = system.dataset.setValue(table, 7,3, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(8,3) =="":
				newData4 = system.dataset.setValue(table, 8,3, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
		elif system.date.getHour24(timeTag) == e:
			table = system.tag.read("[.]EveryHourShift1").value
			if table.getValueAt(0,4) =="":
				newData1 = system.dataset.setValue(table, 0,4, "Blue")
				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(1,4)== "":
				newData2 = system.dataset.setValue(table, 1,4, "Blue")
				system.tag.write("[.]EveryHourShift1",newData2)
			if table.getValueAt(2,4) =="":
				newData3 = system.dataset.setValue(table, 2,4, "Blue")
				system.tag.write("[.]EveryHourShift1",newData3)
			if table.getValueAt(3,4) =="":
				newData4 = system.dataset.setValue(table, 3,4, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(4,4) =="":
				newData4 = system.dataset.setValue(table, 4,4, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(5,4) =="":
				newData4 = system.dataset.setValue(table, 5,4, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(6,4) =="":
				newData4 = system.dataset.setValue(table, 6,4, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(7,4) =="":
				newData4 = system.dataset.setValue(table, 7,4, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(8,4) =="":
				newData4 = system.dataset.setValue(table, 8,4, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			table2 = system.tag.read("[.]Every2HourShift1").value
			if table2.getValueAt(0,2) =="":
				twoData1 = system.dataset.setValue(table2, 0,2, "Blue")
				system.tag.write("[.]Every2HourShift1",twoData1)
			if table2.getValueAt(1,2) =="":
				twoData1 = system.dataset.setValue(table2, 1,2, "Blue")
				system.tag.write("[.]Every2HourShift1",twoData1)
		elif system.date.getHour24(timeTag) == f:
			table = system.tag.read("[.]EveryHourShift1").value
			if table.getValueAt(0,5) =="":
				newData1 = system.dataset.setValue(table, 0,5, "Blue")
				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(1,5)== "":
				newData2 = system.dataset.setValue(table, 1,5, "Blue")
				system.tag.write("[.]EveryHourShift1",newData2)
			if table.getValueAt(2,5) =="":
				newData3 = system.dataset.setValue(table, 2,5, "Blue")
				system.tag.write("[.]EveryHourShift1",newData3)
			if table.getValueAt(3,5) =="":
				newData4 = system.dataset.setValue(table, 3,5, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(4,5) =="":
				newData4 = system.dataset.setValue(table, 4,5, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(5,5) =="":
				newData4 = system.dataset.setValue(table, 5,5, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(6,5) =="":
				newData4 = system.dataset.setValue(table, 6,5, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(7,5) =="":
				newData4 = system.dataset.setValue(table, 7,5, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(8,5) =="":
				newData4 = system.dataset.setValue(table, 8,5, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
		elif system.date.getHour24(timeTag) == g:
			table = system.tag.read("[.]EveryHourShift1").value
			if table.getValueAt(0,6) =="":
				newData1 = system.dataset.setValue(table, 0,6, "Blue")
				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(1,6)== "":
				newData2 = system.dataset.setValue(table, 1,6, "Blue")
				system.tag.write("[.]EveryHourShift1",newData2)
			if table.getValueAt(2,6) =="":
				newData3 = system.dataset.setValue(table, 2,6, "Blue")
				system.tag.write("[.]EveryHourShift1",newData3)
			if table.getValueAt(3,6) =="":
				newData4 = system.dataset.setValue(table, 3,6, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(4,6) =="":
				newData4 = system.dataset.setValue(table, 4,6, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(5,6) =="":
				newData4 = system.dataset.setValue(table, 5,6, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(6,6) =="":
				newData4 = system.dataset.setValue(table, 6,6, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(7,6) =="":
				newData4 = system.dataset.setValue(table, 7,6, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(8,6) =="":
				newData4 = system.dataset.setValue(table, 8,6, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			table2 = system.tag.read("[.]Every2HourShift1").value
			if table2.getValueAt(0,3) =="":
				twoData1 = system.dataset.setValue(table2, 0,3, "Blue")
				system.tag.write("[.]Every2HourShift1",twoData1)
			if table2.getValueAt(1,3) =="":
				twoData1 = system.dataset.setValue(table2, 1,3, "Blue")
				system.tag.write("[.]Every2HourShift1",twoData1)
		elif system.date.getHour24(timeTag) == h:
			table = system.tag.read("[.]EveryHourShift1").value
			if table.getValueAt(0,7) =="":
				newData1 = system.dataset.setValue(table, 0,7, "Blue")
				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(1,7)== "":
				newData2 = system.dataset.setValue(table, 1,7, "Blue")
				system.tag.write("[.]EveryHourShift1",newData2)
			if table.getValueAt(2,7) =="":
				newData3 = system.dataset.setValue(table, 2,7, "Blue")
				system.tag.write("[.]EveryHourShift1",newData3)
			if table.getValueAt(3,7) =="":
				newData4 = system.dataset.setValue(table, 3,7, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(4,7) =="":
				newData4 = system.dataset.setValue(table, 4,7, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(5,7) =="":
				newData4 = system.dataset.setValue(table, 5,7, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(6,7) =="":
				newData4 = system.dataset.setValue(table, 6,7, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(7,7) =="":
				newData4 = system.dataset.setValue(table, 7,7, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(8,7) =="":
				newData4 = system.dataset.setValue(table, 8,7, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
		elif system.date.getHour24(timeTag) == i:
			table = system.tag.read("[.]EveryHourShift1").value
			if table.getValueAt(0,8) =="":
				newData1 = system.dataset.setValue(table, 0,8, "Blue")
				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(1,8)== "":
				newData2 = system.dataset.setValue(table, 1,8, "Blue")
				system.tag.write("[.]EveryHourShift1",newData2)
			if table.getValueAt(2,8) =="":
				newData3 = system.dataset.setValue(table, 2,8, "Blue")
				system.tag.write("[.]EveryHourShift1",newData3)
			if table.getValueAt(3,8) =="":
				newData4 = system.dataset.setValue(table, 3,8, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(4,8) =="":
				newData4 = system.dataset.setValue(table, 4,8, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(5,8) =="":
				newData4 = system.dataset.setValue(table, 5,8, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(6,8) =="":
				newData4 = system.dataset.setValue(table, 6,8, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(7,8) =="":
				newData4 = system.dataset.setValue(table, 7,8, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(8,8) =="":
				newData4 = system.dataset.setValue(table, 8,8, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			
			table2 = system.tag.read("[.]Every2HourShift1").value
			if table2.getValueAt(0,4) =="":
				twoData1 = system.dataset.setValue(table2, 0,4, "Blue")
				system.tag.write("[.]Every2HourShift1",twoData1)
			if table2.getValueAt(1,4) =="":
				twoData1 = system.dataset.setValue(table2, 1,4, "Blue")
				system.tag.write("[.]Every2HourShift1",twoData1)
		elif system.date.getHour24(timeTag) == j:
			table = system.tag.read("[.]EveryHourShift1").value
			if table.getValueAt(0,9) =="":
				newData1 = system.dataset.setValue(table, 0,9, "Blue")
				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(1,9)== "":
				newData2 = system.dataset.setValue(table, 1,9, "Blue")
				system.tag.write("[.]EveryHourShift1",newData2)
			if table.getValueAt(2,9) =="":
				newData3 = system.dataset.setValue(table, 2,9, "Blue")
				system.tag.write("[.]EveryHourShift1",newData3)
			if table.getValueAt(3,9) =="":
				newData4 = system.dataset.setValue(table, 3,9, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(4,9) =="":
				newData4 = system.dataset.setValue(table, 4,9, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(5,9) =="":
				newData4 = system.dataset.setValue(table, 5,9, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(6,9) =="":
				newData4 = system.dataset.setValue(table, 6,9, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(7,9) =="":
				newData4 = system.dataset.setValue(table, 7,9, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(8,9) =="":
				newData4 = system.dataset.setValue(table, 8,9, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
		elif system.date.getHour24(timeTag) == k:
			table = system.tag.read("[.]EveryHourShift1").value
			if table.getValueAt(0,10) =="":
				newData1 = system.dataset.setValue(table, 0,10, "Blue")
				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(1,10)== "":
				newData2 = system.dataset.setValue(table, 1,10, "Blue")
				system.tag.write("[.]EveryHourShift1",newData2)
			if table.getValueAt(2,10) =="":
				newData3 = system.dataset.setValue(table, 2,10, "Blue")
				system.tag.write("[.]EveryHourShift1",newData3)
			if table.getValueAt(3,10) =="":
				newData4 = system.dataset.setValue(table, 3,10, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(4,10) =="":
				newData4 = system.dataset.setValue(table, 4,10, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(5,10) =="":
				newData4 = system.dataset.setValue(table, 5,10, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(6,10) =="":
				newData4 = system.dataset.setValue(table, 6,10, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(7,10) =="":
				newData4 = system.dataset.setValue(table, 7,10, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(8,10) =="":
				newData4 = system.dataset.setValue(table, 8,10, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			table2 = system.tag.read("[.]Every2HourShift1").value
			if table2.getValueAt(0,5) =="":
				twoData1 = system.dataset.setValue(table2, 0,5, "Blue")
				system.tag.write("[.]Every2HourShift1",twoData1)
			if table2.getValueAt(1,5) =="":
				twoData1 = system.dataset.setValue(table2, 1,5, "Blue")
				system.tag.write("[.]Every2HourShift1",twoData1)
		elif system.date.getHour24(timeTag) == l:
			table = system.tag.read("[.]EveryHourShift1").value
			if table.getValueAt(0,11) =="":
				newData1 = system.dataset.setValue(table, 0,11, "Blue")
				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(1,11)== "":
				newData2 = system.dataset.setValue(table, 1,11, "Blue")
				system.tag.write("[.]EveryHourShift1",newData2)
			if table.getValueAt(2,11) =="":
				newData3 = system.dataset.setValue(table, 2,11, "Blue")
				system.tag.write("[.]EveryHourShift1",newData3)
			if table.getValueAt(3,11) =="":
				newData4 = system.dataset.setValue(table, 3,11, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(4,11) =="":
				newData4 = system.dataset.setValue(table, 4,11, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(5,11) =="":
				newData4 = system.dataset.setValue(table, 5,11, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(6,11) =="":
				newData4 = system.dataset.setValue(table, 6,11, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(7,11) =="":
				newData4 = system.dataset.setValue(table, 7,11, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(8,11) =="":
				newData4 = system.dataset.setValue(table, 8,11, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)

Lines 1244-1663

		elif system.date.getHour24(timeTag) == m:
			table = system.tag.read("[.]EveryHourShift1").value
			if table.getValueAt(0,12) =="":
				newData1 = system.dataset.setValue(table, 0,12, "Blue")
				system.tag.write("[.]EveryHourShift1",newData1)
			if table.getValueAt(1,12)== "":
				newData2 = system.dataset.setValue(table, 1,12, "Blue")
				system.tag.write("[.]EveryHourShift1",newData2)
			if table.getValueAt(2,12) =="":
				newData3 = system.dataset.setValue(table, 2,12, "Blue")
				system.tag.write("[.]EveryHourShift1",newData3)
			if table.getValueAt(3,12) =="":
				newData4 = system.dataset.setValue(table, 3,12, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(4,12) =="":
				newData4 = system.dataset.setValue(table, 4,12, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(5,12) =="":
				newData4 = system.dataset.setValue(table, 5,12, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(6,12) =="":
				newData4 = system.dataset.setValue(table, 6,12, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(7,12) =="":
				newData4 = system.dataset.setValue(table, 7,12, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
			if table.getValueAt(8,12) =="":
				newData4 = system.dataset.setValue(table, 8,12, "Blue")
				system.tag.write("[.]EveryHourShift1",newData4)
#			table2 = system.tag.read("[.]Every2HourShift1").value
#			if table2.getValueAt(0,6) =="":
#				twoData1 = system.dataset.setValue(table2, 0,6, "Blue")
#				system.tag.write("[.]Every2HourShift1",twoData1)
#			if table2.getValueAt(1,6) =="":
#				twoData1 = system.dataset.setValue(table2, 1,6, "Blue")
#				system.tag.write("[.]Every2HourShift1",twoData1)

		elif system.date.getHour24(timeTag) ==n:
			table = system.tag.read("[.]EveryHourShift2").value
			if table.getValueAt(0,1) =="":
				newData1 = system.dataset.setValue(table, 0,1, "Blue")
				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(1,1)== "":
				newData2 = system.dataset.setValue(table, 1,1, "Blue")
				system.tag.write("[.]EveryHourShift2",newData2)
			if table.getValueAt(2,1) =="":
				newData3 = system.dataset.setValue(table, 2,1, "Blue")
				system.tag.write("[.]EveryHourShift2",newData3)
			if table.getValueAt(3,1) =="":
				newData4 = system.dataset.setValue(table, 3,1, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(4,1) =="":
				newData4 = system.dataset.setValue(table, 4,1, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(5,1) =="":
				newData4 = system.dataset.setValue(table, 5,1, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(6,1) =="":
				newData4 = system.dataset.setValue(table, 6,1, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(7,1) =="":
				newData4 = system.dataset.setValue(table, 7,1, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(8,1) =="":
				newData4 = system.dataset.setValue(table, 8,1, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
		elif system.date.getHour24(timeTag) == o:
			table = system.tag.read("[.]EveryHourShift2").value
			if table.getValueAt(0,2) =="":
				newData1 = system.dataset.setValue(table, 0,2, "Blue")
				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(1,2)== "":
				newData2 = system.dataset.setValue(table, 1,2, "Blue")
				system.tag.write("[.]EveryHourShift2",newData2)
			if table.getValueAt(2,2) =="":
				newData3 = system.dataset.setValue(table, 2,2, "Blue")
				system.tag.write("[.]EveryHourShift2",newData3)
			if table.getValueAt(3,2) =="":
				newData4 = system.dataset.setValue(table, 3,2, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(4,2) =="":
				newData4 = system.dataset.setValue(table, 4,2, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(5,2) =="":
				newData4 = system.dataset.setValue(table, 5,2, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(6,2) =="":
				newData4 = system.dataset.setValue(table, 6,2, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(7,2) =="":
				newData4 = system.dataset.setValue(table, 7,2, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(8,2) =="":
				newData4 = system.dataset.setValue(table, 8,2, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			table2 = system.tag.read("[.]Every2HourShift2").value
			if table2.getValueAt(0,1) =="":
				twoData1 = system.dataset.setValue(table2, 0,1, "Blue")
				system.tag.write("[.]Every2HourShift2",twoData1)
			if table2.getValueAt(1,1) =="":
				twoData1 = system.dataset.setValue(table2, 1,1, "Blue")
				system.tag.write("[.]Every2HourShift2",twoData1)
		elif system.date.getHour24(timeTag) == p:
			table = system.tag.read("[.]EveryHourShift2").value
			if table.getValueAt(0,3) =="":
				newData1 = system.dataset.setValue(table, 0,3, "Blue")
				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(1,3)== "":
				newData2 = system.dataset.setValue(table, 1,3, "Blue")
				system.tag.write("[.]EveryHourShift2",newData2)
			if table.getValueAt(2,3) =="":
				newData3 = system.dataset.setValue(table, 2,3, "Blue")
				system.tag.write("[.]EveryHourShift2",newData3)
			if table.getValueAt(3,3) =="":
				newData4 = system.dataset.setValue(table, 3,3, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(4,3) =="":
				newData4 = system.dataset.setValue(table, 4,3, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(5,3) =="":
				newData4 = system.dataset.setValue(table, 5,3, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(6,3) =="":
				newData4 = system.dataset.setValue(table, 6,3, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(7,3) =="":
				newData4 = system.dataset.setValue(table, 7,3, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(8,3) =="":
				newData4 = system.dataset.setValue(table, 8,3, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
		elif system.date.getHour24(timeTag) == q:
			table = system.tag.read("[.]EveryHourShift2").value
			if table.getValueAt(0,4) =="":
				newData1 = system.dataset.setValue(table, 0,4, "Blue")
				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(1,4)== "":
				newData2 = system.dataset.setValue(table, 1,4, "Blue")
				system.tag.write("[.]EveryHourShift2",newData2)
			if table.getValueAt(2,4) =="":
				newData3 = system.dataset.setValue(table, 2,4, "Blue")
				system.tag.write("[.]EveryHourShift2",newData3)
			if table.getValueAt(3,4) =="":
				newData4 = system.dataset.setValue(table, 3,4, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(4,4) =="":
				newData4 = system.dataset.setValue(table, 4,4, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(5,4) =="":
				newData4 = system.dataset.setValue(table, 5,4, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(6,4) =="":
				newData4 = system.dataset.setValue(table, 6,4, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(7,4) =="":
				newData4 = system.dataset.setValue(table, 7,4, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(8,4) =="":
				newData4 = system.dataset.setValue(table, 8,4, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			table2 = system.tag.read("[.]Every2HourShift2").value
			if table2.getValueAt(0,2) =="":
				twoData1 = system.dataset.setValue(table2, 0,2, "Blue")
				system.tag.write("[.]Every2HourShift2",twoData1)
			if table2.getValueAt(1,2) =="":
				twoData1 = system.dataset.setValue(table2, 1,2, "Blue")
				system.tag.write("[.]Every2HourShift2",twoData1)
		elif system.date.getHour24(timeTag) == r:
			table = system.tag.read("[.]EveryHourShift2").value
			if table.getValueAt(0,5) =="":
				newData1 = system.dataset.setValue(table, 0,5, "Blue")
				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(1,5)== "":
				newData2 = system.dataset.setValue(table, 1,5, "Blue")
				system.tag.write("[.]EveryHourShift2",newData2)
			if table.getValueAt(2,5) =="":
				newData3 = system.dataset.setValue(table, 2,5, "Blue")
				system.tag.write("[.]EveryHourShift2",newData3)
			if table.getValueAt(3,5) =="":
				newData4 = system.dataset.setValue(table, 3,5, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(4,5) =="":
				newData4 = system.dataset.setValue(table, 4,5, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(5,5) =="":
				newData4 = system.dataset.setValue(table, 5,5, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(6,5) =="":
				newData4 = system.dataset.setValue(table, 6,5, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(7,5) =="":
				newData4 = system.dataset.setValue(table, 7,5, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(8,5) =="":
				newData4 = system.dataset.setValue(table, 8,5, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
		elif system.date.getHour24(timeTag) == s:
			table = system.tag.read("[.]EveryHourShift2").value
			if table.getValueAt(0,6) =="":
				newData1 = system.dataset.setValue(table, 0,6, "Blue")
				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(1,6)== "":
				newData2 = system.dataset.setValue(table, 1,6, "Blue")
				system.tag.write("[.]EveryHourShift2",newData2)
			if table.getValueAt(2,6) =="":
				newData3 = system.dataset.setValue(table, 2,6, "Blue")
				system.tag.write("[.]EveryHourShift2",newData3)
			if table.getValueAt(3,6) =="":
				newData4 = system.dataset.setValue(table, 3,6, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(4,6) =="":
				newData4 = system.dataset.setValue(table,4,6, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(5,6) =="":
				newData4 = system.dataset.setValue(table, 5,6, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(6,6) =="":
				newData4 = system.dataset.setValue(table, 6,6, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(7,6) =="":
				newData4 = system.dataset.setValue(table, 7,6, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(8,6) =="":
				newData4 = system.dataset.setValue(table, 8,6, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			table2 = system.tag.read("[.]Every2HourShift2").value
			if table2.getValueAt(0,3) =="":
				twoData1 = system.dataset.setValue(table2, 0,3, "Blue")
				system.tag.write("[.]Every2HourShift2",twoData1)
			if table2.getValueAt(1,3) =="":
				twoData1 = system.dataset.setValue(table2, 1,3, "Blue")
				system.tag.write("[.]Every2HourShift2",twoData1)
		elif system.date.getHour24(timeTag) == t:
			table = system.tag.read("[.]EveryHourShift2").value
			if table.getValueAt(0,7) =="":
				newData1 = system.dataset.setValue(table, 0,7, "Blue")
				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(1,7)== "":
				newData2 = system.dataset.setValue(table, 1,7, "Blue")
				system.tag.write("[.]EveryHourShift2",newData2)
			if table.getValueAt(2,7) =="":
				newData3 = system.dataset.setValue(table, 2,7, "Blue")
				system.tag.write("[.]EveryHourShift2",newData3)
			if table.getValueAt(3,7) =="":
				newData4 = system.dataset.setValue(table, 3,7, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(4,7) =="":
				newData4 = system.dataset.setValue(table, 4,7, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(5,7) =="":
				newData4 = system.dataset.setValue(table, 5,7, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(6,7) =="":
				newData4 = system.dataset.setValue(table, 6,7, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(7,7) =="":
				newData4 = system.dataset.setValue(table, 7,7, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(8,7) =="":
				newData4 = system.dataset.setValue(table, 8,7, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
		elif system.date.getHour24(timeTag) == u:
			table = system.tag.read("[.]EveryHourShift2").value
			if table.getValueAt(0,8) =="":
				newData1 = system.dataset.setValue(table, 0,8, "Blue")
				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(1,8)== "":
				newData2 = system.dataset.setValue(table, 1,8, "Blue")
				system.tag.write("[.]EveryHourShift2",newData2)
			if table.getValueAt(2,8) =="":
				newData3 = system.dataset.setValue(table, 2,8, "Blue")
				system.tag.write("[.]EveryHourShift2",newData3)
			if table.getValueAt(3,8) =="":
				newData4 = system.dataset.setValue(table, 3,8, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(4,8) =="":
				newData4 = system.dataset.setValue(table, 4,8, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(5,8) =="":
				newData4 = system.dataset.setValue(table, 5,8, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(6,8) =="":
				newData4 = system.dataset.setValue(table, 6,8, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(7,8) =="":
				newData4 = system.dataset.setValue(table, 7,8, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(8,8) =="":
				newData4 = system.dataset.setValue(table, 8,8, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			table2 = system.tag.read("[.]Every2HourShift2").value
			if table2.getValueAt(0,4) =="":
				twoData1 = system.dataset.setValue(table2, 0,4, "Blue")
				system.tag.write("[.]Every2HourShift2",twoData1)
			if table2.getValueAt(1,4) =="":
				twoData1 = system.dataset.setValue(table2, 1,4, "Blue")
				system.tag.write("[.]Every2HourShift2",twoData1)
		elif system.date.getHour24(timeTag) == v:
			table = system.tag.read("[.]EveryHourShift2").value
			if table.getValueAt(0,9) =="":
				newData1 = system.dataset.setValue(table, 0,9, "Blue")
				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(1,9)== "":
				newData2 = system.dataset.setValue(table, 1,9, "Blue")
				system.tag.write("[.]EveryHourShift2",newData2)
			if table.getValueAt(2,9) =="":
				newData3 = system.dataset.setValue(table, 2,9, "Blue")
				system.tag.write("[.]EveryHourShift2",newData3)
			if table.getValueAt(3,9) =="":
				newData4 = system.dataset.setValue(table, 3,9, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(4,9) =="":
				newData4 = system.dataset.setValue(table, 4,9, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(5,9) =="":
				newData4 = system.dataset.setValue(table, 5,9, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(6,9) =="":
				newData4 = system.dataset.setValue(table, 6,9, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(7,9) =="":
				newData4 = system.dataset.setValue(table, 7,9, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(8,9) =="":
				newData4 = system.dataset.setValue(table, 8,9, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
		elif system.date.getHour24(timeTag) == w:
			table = system.tag.read("[.]EveryHourShift2").value
			if table.getValueAt(0,10) =="":
				newData1 = system.dataset.setValue(table, 0,10, "Blue")
				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(1,10)== "":
				newData2 = system.dataset.setValue(table, 1,10, "Blue")
				system.tag.write("[.]EveryHourShift2",newData2)
			if table.getValueAt(2,10) =="":
				newData3 = system.dataset.setValue(table, 2,10, "Blue")
				system.tag.write("[.]EveryHourShift2",newData3)
			if table.getValueAt(3,10) =="":
				newData4 = system.dataset.setValue(table, 3,10, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(4,10) =="":
				newData4 = system.dataset.setValue(table, 4,10, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(5,10) =="":
				newData4 = system.dataset.setValue(table, 5,10, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(6,10) =="":
				newData4 = system.dataset.setValue(table, 6,10, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(7,10) =="":
				newData4 = system.dataset.setValue(table, 7,10, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(8,10) =="":
				newData4 = system.dataset.setValue(table, 8,10, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			table2 = system.tag.read("[.]Every2HourShift2").value
			if table2.getValueAt(0,5) =="":
				twoData1 = system.dataset.setValue(table2, 0,5, "Blue")
				system.tag.write("[.]Every2HourShift2",twoData1)
			if table2.getValueAt(1,5) =="":
				twoData1 = system.dataset.setValue(table2, 1,5, "Blue")
				system.tag.write("[.]Every2HourShift2",twoData1)
		elif system.date.getHour24(timeTag) == x:
			table = system.tag.read("[.]EveryHourShift2").value
			if table.getValueAt(0,11) =="":
				newData1 = system.dataset.setValue(table, 0,11, "Blue")
				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(1,11)== "":
				newData2 = system.dataset.setValue(table, 1,11, "Blue")
				system.tag.write("[.]EveryHourShift2",newData2)
			if table.getValueAt(2,11) =="":
				newData3 = system.dataset.setValue(table, 2,11, "Blue")
				system.tag.write("[.]EveryHourShift2",newData3)
			if table.getValueAt(3,11) =="":
				newData4 = system.dataset.setValue(table, 3,11, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(4,11) =="":
				newData4 = system.dataset.setValue(table, 4,11, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(5,11) =="":
				newData4 = system.dataset.setValue(table, 5,11, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(6,11) =="":
				newData4 = system.dataset.setValue(table, 6,11, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(7,11) =="":
				newData4 = system.dataset.setValue(table, 7,11, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(8,11) =="":
				newData4 = system.dataset.setValue(table, 8,11, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
		elif system.date.getHour24(timeTag) == a:
			table = system.tag.read("[.]EveryHourShift2").value
			if table.getValueAt(0,12) =="":
				newData1 = system.dataset.setValue(table, 0,12, "Blue")
				system.tag.write("[.]EveryHourShift2",newData1)
			if table.getValueAt(1,12)== "":
				newData2 = system.dataset.setValue(table, 1,12, "Blue")
				system.tag.write("[.]EveryHourShift2",newData2)
			if table.getValueAt(2,12) =="":
				newData3 = system.dataset.setValue(table, 2,12, "Blue")
				system.tag.write("[.]EveryHourShift2",newData3)
			if table.getValueAt(3,12) =="":
				newData4 = system.dataset.setValue(table, 3,12, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(4,12) =="":
				newData4 = system.dataset.setValue(table, 4,12, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(5,12) =="":
				newData4 = system.dataset.setValue(table, 5,12, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(6,12) =="":
				newData4 = system.dataset.setValue(table, 6,12, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(7,12) =="":
				newData4 = system.dataset.setValue(table, 7,12, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)
			if table.getValueAt(8,12) =="":
				newData4 = system.dataset.setValue(table, 8,12, "Blue")
				system.tag.write("[.]EveryHourShift2",newData4)

JordanCClark I am just going to duplicate a Time tag from the other lines and go back through and remake the edits. It is a very long code and if it is something as silly as an indentation error then I dont want anyone parsing through my own error ridden code.

Plus, I should be able to catch it/not make the error again (hopefully) the second time around. Thank you for all your help!

Interesting. I copied and pasted your code into a function, and I didn't get the squiggly line.
image
If you figure it out, please post the solution.

Well that's interesting.

Even more interesting: It seems like the error comes at this point below. See how I have commented out the line and there is no error line in the top right-hand corner of the script, right below 'Enabled' (screenshot 1). But as soon as I uncomment the highlighted code, the red error line appears in the top right-hand corner (screenshot 2). I'm not sure what to make of it.

Screenshot 1

Screenshot 2

Interesting. I have that code in my copy, but it occurs at rows 798, so I must me missing almost two hundred lines somehow. I don't have the answer, but I do have a recommendation that could possibly help. It looks like hundreds of lines could be eliminated from this code with for loops to loop through the rows and columns of the dataset.
Something like this:

for row in range(table.rowCount):
	for column in range(table.columnCount):
		if table.getValueAt(row, column) =="":
			newData = system.dataset.setValue(table, row, column, "Red")
			system.tag.write("[.]EveryHourShift1",newData)

The EveryHourShift could probably be iterated in some way as well.

1 Like

Thank you for the suggestion. This is our older version of Ignition that I am now in charge of maintaining. Unfortunately I have inherited a lot of this project, so I am constantly running into issues like this.

I figured since the code was so repetitive there had to be a better way to iterate through each line, however I am still fairly very new when it comes to coming up with my own code.

I truly appreciate your suggestion, I will have to take a day and dive in and try to reiterate to save time when I have to add in a new machine, as it takes about 20 min right now to go through the 1600 lines of code just to manually add in. Thank you for your time.

And for anyone who is wondering about the solution it looked like I ran through the tag character or line limit. It started working once I split the code into two separate tags.

1 Like

Damn I've never seen so many ifs before !

I'm up for helping you with a refactor, if you can explain the logic behind all this.
Like, what's table, what does it contain, how does it impact the tag writes, can several of those conditions be true (since it's only if and not elif, and there's only 2 tags that can be written to, only the last true condition for each of those 2 tags actually does something. Which means you could be overwriting the same tag over and over again hundreded of times, which is FAR from something you want to be doing)


(I'm so sad that I couldn't find a gif)

3 Likes

Not to mention this is all being done in a Tag Event Script. There is a very good chance that there are events being missed.

1 Like

I highly recommend taking Pascal up on his offer. He's done many refactors on this site, and he does excellent work.

I took a closer look, and there are a few things that need to be cleared:

  • It actually won't be overwriting hundreds of tags, as at most one of the a, b, c... branches will ever be executed, which means 11 writes at most.
  • who the hell thought of this a = 6, b = a + 1... madness ? What is going on here ?
    I can see there are 24 of them and they correspond to hours, but... Why make it even less clear ?
    Why is s midnight ? Why does b (7) correspond to the first column (I suspect a day starts at 7 ?) ?
    Why is the every2hoursShift not ACTUALLY every 2 hours ?
  • When an innermost branch is entered, do you want to change the color for every cell that's empty, or just the last one ?
  • Can there actually be several empty cells in the same column ?
    Currently, it only does it for the last one, as the same base table is used in each condition, which means if the first cell is empty, it's value is changed, the tag is written, but then if another cell is also empty, this previous change is discarded. Is that intended behavior ?
  • Are the two main branches strictly identical, except for the color ?

I can reduce all this to something that would actually be maintainable without changing what it does, but with more information it may be possible to go further and make the logic a bit less confusing.

1 Like

Okay so here's a first draft that should be functionally equivalent, except on one point: it writes the color value in every empty cell from the processed column. This seemed like the most logical thing to do.
If that's not the expected behavior, I'll do another version.
Note: I insist on should, because frankly I might have missed quirks somewhere in the 1600 lines of ifs :X

I don't like that there are 2 separate tag reads, but it was simpler this way.

I might do another pass on this a bit later and see what can be improved, but for now I think I'll go put my head in the oven.
Just so you know, the file I used while doing this was named if_hell.py.
image

PMStatus = system.tag.readBlocking(["[.]PMStatus"])[0].value
if PMStatus:
	tags_paths = ["[.]EveryHourShift1", "[.]Every2HourShift1"]
	color = "Red"
else:
	tags_paths = ["[.]EveryHourShift2", "[.]Every2HourShift2"]
	color = "Blue"

shift1h, shift2h = [
	system.dataset.toPyDataSet(qval.value)
	for qval in system.tag.readBlocking(tags_paths)
]

hour = system.date.getHour24(currentValue.value)
col_index_1h = (hour - 6) % 12
col_index_2h = col_index_1h / 2

def fill_empty_cells(ds, col_index, value):
	for row in ds:
		if row[col_index] == "":
			row[col_index] = value

fill_empty_cells(shift1h, col_index_1h, color)
if col_index_2h in [8, 10, 12, 14, 16, 20, 22, 0, 2, 4]:
	fill_empty_cells(shift2h, col_index_2h, color)

shift1h = system.toDataSet(shift1h)
shift2h = system.toDataSet(shift2h)
system.tag.writeBlocking(tags_paths, [shift1h, shift2h])
2 Likes

very fitting,

i hope not all code is like this, else you sure have your work cut out for you xd
if you wrote this though, i suggest you loop up who loops work in python

1600 lines of code reduced to less than 25 lines of code: Nicely done :+1: