Black Lives Matter. Please consider donating to Black Girls Code today.
Dash Enterprise delivers an incredible 21x cost savings 💸Download the e-book!

Conditional Formatting - Comparing multiple columns

I have a data table and I’m trying to conditionally format one of the columns (say ‘status’) based on some other numeric columns (‘A’, ‘B’, ‘C’, ‘D’). This is what I tried:

style_data_conditional=[
{'if':
      {
        'filter_query': '{A} = {C} && {B} = {D}',
        'column_id': 'status'
      },
     'color': 'rgb(50,205,50)'
}
]

But this gives me the following error:
DataTable filtering syntax is invalid for query: {A} = {C} && {B} = {D}

What am I doing wrong?

Hi @SJay

I don’t get an error message when I use this syntax.

There were some new features added to conditional formatting in v1.12. What version of Dash are you using?

1 Like