Hi,
I want to change the color of font in the perspective table on giving condition.
I tried all steps which is in forum links related to this topic, but not succeeded.
Example:
if (value of 1st column is greater than 2nd column)
change the font color of 2nd column to green
else remains same
as in vision I have done but not getting in perspective.
please guide
Thank you
yes I tried, I got it for specific row, given hardcoded values in the script.
But I want to change only one column font color by comparing the values with other column.
Then we should read the row values of one column and compare other column right.
how can I apply this in script.

Something like the below should work for your script transform. I've assumed that the data going into your table is a dataset.
output_json = []
style_red = {"color": "#FF0000"}
style_black = {"color": "000000"}
for row in range(value.getRowCount()):
row_object = {}
row_value = {}
for col in range(value.getColumnCount()):
if value.getColumnName(col) == "Actual":
if value.getValueAt(row, "Actual") < value.getValueAt(row,"Target"):
cell_style = style_red
else:
cell_style = style_black
else :
cell_style = style_black
row_value[value.getColumnName(col)] = {'value':value.getValueAt(row, col),'style':cell_style}
row_object['value'] = row_value
output_json.append(row_object)
return output_json
Sorry I realised I have a typo in my transform in the style_black colour, obviously a hex colour code needs to start with a #.
The column positions in the output json don't really matter, you can specify column order when you set up the column configuration on your table.
1 Like
Thank you so much. I got it exactly.