Set cell background by script

Can I set the color for a row in a specific column by script?

The problem solved :smiley:

Nice job. :slight_smile:

Very good. :thumb_left:

Please can you tell us, How was it solved?

I needed to change the background of the cell depending on the value. I found a next decision:

add to your Table.Extention Functions something like this:

Column_Value = self.data.getValueAt(row,‘Column_Value’) #5th column

if col==5:
if int(Column_Value)==100:
return “Red”
elif int(Column_Value)==50:
return “Yellow”
else:
return defaultColor

P.S.: row & col are extension table attributes. They do not need to be created

Thank you so much, I could develop what I needed.
I did the next script in the getBackgroundAt extension function in the table scripting:

procEnab_1 = system.tag.read("[Client]INTERNAS/Receta_CIP_LK/TablaPasos/procEnab_1").value
procEnab_2 = system.tag.read("[Client]INTERNAS/Receta_CIP_LK/TablaPasos/procEnab_2").value
procEnab_3 = system.tag.read("[Client]INTERNAS/Receta_CIP_LK/TablaPasos/procEnab_3").value
procEnab_4 = system.tag.read("[Client]INTERNAS/Receta_CIP_LK/TablaPasos/procEnab_4").value
procEnab_5 = system.tag.read("[Client]INTERNAS/Receta_CIP_LK/TablaPasos/procEnab_5").value
procEnab_6 = system.tag.read("[Client]INTERNAS/Receta_CIP_LK/TablaPasos/procEnab_6").value
procEnab_7 = system.tag.read("[Client]INTERNAS/Receta_CIP_LK/TablaPasos/procEnab_7").value
procEnab_8 = system.tag.read("[Client]INTERNAS/Receta_CIP_LK/TablaPasos/procEnab_8").value
procEnab_9 = system.tag.read("[Client]INTERNAS/Receta_CIP_LK/TablaPasos/procEnab_9").value
procEnab_10 = system.tag.read("[Client]INTERNAS/Receta_CIP_LK/TablaPasos/procEnab_10").value
procEnab_11 = system.tag.read("[Client]INTERNAS/Receta_CIP_LK/TablaPasos/procEnab_11").value
procEnab_12 = system.tag.read("[Client]INTERNAS/Receta_CIP_LK/TablaPasos/procEnab_12").value
procEnab_13 = system.tag.read("[Client]INTERNAS/Receta_CIP_LK/TablaPasos/procEnab_13").value
procEnab_14 = system.tag.read("[Client]INTERNAS/Receta_CIP_LK/TablaPasos/procEnab_14").value
procEnab_15 = system.tag.read("[Client]INTERNAS/Receta_CIP_LK/TablaPasos/procEnab_15").value
procEnab_16 = system.tag.read("[Client]INTERNAS/Receta_CIP_LK/TablaPasos/procEnab_16").value
selRow = self.selectedRow
#data
#colName = self.data.getColumnNames()[col]	
if row == selRow and col == 3 and procEnab_1 == 1:
	return "255,255,204"
elif row == selRow and col == 4 and procEnab_2 == 1:
	return "255,255,204"
elif row == selRow and col == 5 and procEnab_3 == 1:
	return "255,255,204"
elif row == selRow and col == 6 and procEnab_4 == 1:
	return "255,255,204"
elif row == selRow and col == 7 and procEnab_5 == 1:
	return "255,255,204"
elif row == selRow and col == 8 and procEnab_6 == 1:
	return "255,255,204"
elif row == selRow and col == 9 and procEnab_7 == 1:
	return "255,255,204"
elif row == selRow and col == 10 and procEnab_8 == 1:
	return "255,255,204"
elif row == selRow and col == 11 and procEnab_9 == 1:
	return "255,255,204"
elif row == selRow and col == 12 and procEnab_10 == 1:
	return "255,255,204"
elif row == selRow and col == 13 and procEnab_11 == 1:
	return "255,255,204"
elif row == selRow and col == 14 and procEnab_12 == 1:
	return "255,255,204"
elif row == selRow and col == 15 and procEnab_13 == 1:
	return "255,255,204"
elif row == selRow and col == 16 and procEnab_14 == 1:
	return "255,255,204"
elif row == selRow and col == 17 and procEnab_15 == 1:
	return "255,255,204"
elif row == selRow and col == 18 and procEnab_16 == 1:
	return "255,255,204"
else:
	return defaultColor

Thank for your help! Regards