I’m trying to turn specified cells in a power table to red. I have created custom properties to the Root Container. I am pulling values from a Database Query, successfully. I am trying to read those values and use the script below to turn the cells that are out of spec red. I’m not real sure why it isn’t working.
This script is on the configureCell function for the power table.
kibbleUCL = self.parent.kibbleUCL
kibbleLCL = self.parent.kibbleLCL
netWeightUCL = self.parent.netWeightUCL
netWeightLCL = self.parent.netWeightLCL
prodTempUCL = self.parent.prodTempUCL
prodTempLCL = self.parent.prodTempLCL
ambientTempUCL = self.parent.ambientTempUCL
ambientTempLCL = self.parent.ambientTempLCL
diffTempUCL = self.parent.diffTempUCL
diffTempLCL = self.parent.diffTempLCL
densityUCL = self.parent.densityUCL
densityLCL = self.parent.densityLCL
#Visual Inspection
if colName == 'Visual Inspection (Check = Ok / No Check = Not Ok)':
if value == 0:
return {'background' : 'red'}
#Kibble/Bit Ratio
if colName == 'Kibble / Bit Ratio':
if value > kibbleUCL:
return {'background' : 'red'}
elif value < kibbleLCL:
return {'background' : 'red'}
#Correct Packaging
if colName == 'Correct Packaging (Check = Ok / No Check = Not Ok)':
if value == 0:
return {'background' : 'red'}
#Bag Defects
if colName == 'Bag Defects (Check = Ok / No Check = Not Ok)':
if value == 0:
return {'background' : 'red'}
#Net Weight
if colName == 'Net Weight':
if value > netWeightUCL:
return {'background' : 'red'}
elif value < netWeightLCL:
return {'background' : 'red'}
#Prod Temp
if colName == 'Product Temp':
if value > prodTempUCL:
return {'background' : 'red'}
elif value < prodTempLCL:
return {'background' : 'red'}
#Ambient Temp
if colName == 'Ambient Temp':
if value > ambientTempUCL:
return {'background' : 'red'}
elif value < ambientTempLCL:
return {'background' : 'red'}
#Ambient Temp
if colName == 'Difference in Temps':
if value > diffTempUCL:
return {'background' : 'red'}
elif value < diffTempLCL:
return {'background' : 'red'}
#Density Setpoint
if colName == 'Density':
if value > densityUCL:
return {'background' : 'red'}
elif value < densityLCL:
return {'background' : 'red'}
#Rework
if colName == 'Rework (Check = Yes / No Check = No)':
if value == 1:
return {'background' : 'red'}
#Date Code Correct
if colName == 'Date Code is Correct (Check = 5/5 bags / No Check = 1 or more / 5)':
if value == 0:
return {'background' : 'red'}
#Bags Sealed
if colName == 'Bag sealed Properly (Check = 5/5 bags / No Check = 1 or more / 5)':
if value == 0:
return {'background' : 'red'}
#Date Code Legible
if colName == 'Date Code is Legible (Check = 5/5 bags / No Check = 1 or more / 5)':
if value == 0:
return {'background' : 'red'}
#Date Code Correct Location
if colName == 'Date Code is Correct Location (Check = 5/5 bags / No Check = 1 or more / 5)':
if value == 0:
return {'background' : 'red'}