Compare Column Data in Tables

Hey all!

At the moment you can only set properties on components if they have specific methods allowing you to do so (check out this post for more detail).

Since you're trying to dynamically set the background you can use an inline transformer in the "Background" field to determine the color. How you actually write the JS can vary but here is one example that uses the self and i variables which are dynamically interpolated based on the cell - self represents the value of the cell and i represents the row index:

This checks to see if the value in the cell is equal to the value of the name column in the corresponding row of table1.

**Note** the exact syntax can vary here a bit depending on the structure of your table data. This example assumes your data is an array of row objects, however, if your data is an object of column arrays, as with SQL queries, you might want something like {{ self !== table1.data.name[i] ? '#ffaaaa' : 'white' }} or {{ self !== formatDataAsArray(table1.data)[i].name ? "#ffaaaa" : "white" }} instead.

Let us know if that works!

1 Like