Assign tag colours through array

Hi,

I have a large table which has a column 'courses' which is formatted as tags. The column of tags could be one of one hundred different things so the standard 'item === 'something' ? 'onecolour' : 'anothercolour', isn't ideal as I would have to list everything. I have another column in the table which is 'tagcolour'. I have created an array using {{ readCourses.data.tagcolour }} which returns the below, so it looks correct but doesn't work - any ideas where I am going wrong?

image

Try {{ readCourses.data.tagcolour[0] }} as it seems you have an extra [ and ] there....

Hi,

Thank you but it's not working as it should. For example, in the example below, the array has different values

image

But when I add the [0], it only selects the first value and applies it to everything

image

If you could share the table data as a whole it would be helpful or some screenshots as well but my first thought here is that your data for those tag colors is not formatted properly and perhaps you may want to rethink how you are going about wanting to assign colors when the table is rendered versus beforehand....

I have had a play about and this seems to work - {{ table1.data.map(row => row.tagcolour)[i] }}

Thank you