Conditional Format (Cell background and text)

  • Goal: I need to apply a conditional format on the column background.

  • Steps: Al the suggestions I found does not work - a lot of snippets example for chatGP and Gemini.

  • Details:

  • Screenshots:

  • App json export: (here's how to get a json export)

Hi @ERIZZI61 Welcome to the community

1. First, click on the table is in your Retool app to bring up the properties sidebar.

2. Scroll down to the 'Column settings' section and either select the relevant column name from the dropdown menu or add a new one.

3. In the appearance section you can set the logic for your color and text

{{currentSourceRow.your_column_name === "your_condition" ? "red" : "white"}}


Hope this helps

Thanks Milan for your prompt reply .

The snippet does not show any error but it does not work .

{{currentSourceRow.weeks_min === "<4" ? "red" : "white"}}

@ERIZZI61
weeks_min is a string I assume?


it works on my end. Maybe its something simple like refreshing or unmapping and mapping the data source.
If you are referring to text instead of color, you can do that in mapped value directly

Thanks a lot Milan, I really appreciated your prompt support. The issue is fixed and I create a better conditional snippet as per follow.

{{ currentSourceRow.weeks_min < -4 || currentSourceRow.weeks_min > 24.5 ? "violet" :
(currentSourceRow.weeks_min < 4 ? "red" :
(currentSourceRow.weeks_min <= 8.5 ? "orange" :
(currentSourceRow.weeks_min <= 12.49 ? "green" : "blue")))}}