Hi guys,
I need to change the color for the rows in a table where my part number matches with a part number in a list.
My “else” works, but the style in my “if” does not change. And it’s weird, because I print the style on the console and I see the style in the output table. However, the same code in the Transform in Bindings does not change the style.
I appreciate any help.
if self.getSibling("Checkbox").props.selected == True:
PartNumber = '84906731SH' """self.getSibling("Label_3").props.text"""
Table = system.db.runPrepQuery("SELECT distinct B2.[ParentPart] FROM [BNDSYS02].[dbo].[BOM] B1 join [BNDSYS02].[dbo].[BOM] B2 on B1.ChildPart = B2.ChildPart inner join [Ignition].[dbo].[v_kanban] on B2.ParentPart = Part where B1.ParentPart = ? and B2.SourcePlant = 03", [PartNumber])
output_json = []
list = []
style_red = {"backgroundColor": "#FF0000"}
style_blue = {"color": "#FFFFFF", "backgroundColor": "#0000D9", "fontWeight": "bold"}
for row in range(Table.getRowCount()):
for col in range(Table.getColumnCount()):
list.append( str(Table.getValueAt(row,col).replace(' ','') ))
for row in range(value.getRowCount()):
row_object = {}
row_value = {}
row_style = {}
for col in range(value.getColumnCount()):
row_value[value.getColumnName(col)] = value.getValueAt(row, col)
row_object['value'] = row_value
if value.getValueAt(row, col) in list:
row_style = style_blue
row_object['style'] = row_style
output_json.append(row_object)
return output_json
else:
output_json = []
style_red = {"backgroundColor": "#FF0000"}
style_green = {"backgroundColor": "#00AA00", "fontWeight": "bold", "fontSize": 35}
style_yellow = {"backgroundColor": "#FFFF00"}
for row in range(value.getRowCount()):
row_object = {}
row_value = {}
row_style = {}
for col in range(value.getColumnCount()):
row_value[value.getColumnName(col)] = value.getValueAt(row, col)
row_object['value'] = row_value
if value.getValueAt(row, col) == value.getValueAt(0, 0):
row_style = style_green
row_object['style'] = row_style
output_json.append(row_object)
return output_json