I want to format some cells of my dash table: backgroundColor of values in column T1 to green if the value in column T1 is equal to the value of column P1 for each row.
It works fine with the following code:
{
'if': {
'filter_query': '{T1}={P1},
'column_id': 'T1'
},
'backgroundColor': 'green',
'color': 'white'
}
But I need to format in the same way columns T2, T3, …, T18 if they are equal to P2, P3, …, P18. I have tried:
{
'if': {
'filter_query': "'{T"+str(x)+"}={P"+str(x)+"}'",
'column_id': "'T"+str(x)+"'"
},
'backgroundColor': 'green',
'color': 'white'
} for x in range(1, 19)
when I run my code, there is no error displayed but the cells are not formatted at all.
Any ideas of what I’m doing wrong? Thanks for any help.
I have tried several ways to concatenate without success.