With the macro table transformer I would like to change the colour of the row of the table depending on the status that is set at the first cell of each row.
For example: If the status is yellow with title "In Bearbeitung" then the entire row should be displayed in light yellow. If the status is red with title "Offen" then the entire row should be displayed in light red an so on...
What would be the sql query for this case?
Any help is highly appreciated!
Hello @Katerina Rudkovskaya [Stiltsoft]
Thank you for your answer. I have already checked this site but didn't get further as there is no example for my use case (condition depending on status macro to colour the entire row). Since I am not experienced in SQL queries, I was hoping someone could help me with this case.
It seems that your case and the case in our documentation are alike. Statuses are considered as plain text for the conditions (it doesn't matter what color is the lozenge, only the title matters) and it also doesn't matter if you need to color one column or several - it is done separately column by column.
Maybe this example will make more sense:
SELECT T1.'Status',
FORMATWIKI("{cell:bgColor=" +
CASE WHEN T1.'Status' = "NEW" THEN "Red"
WHEN T1.'Status' = "OLD" THEN "Yellow"
ELSE "Grey"
END
+"}" + T1.'Output' + "{cell}")
AS 'Output',
FORMATWIKI("{cell:bgColor=" +
CASE WHEN T1.'Status' = "NEW" THEN "Red"
WHEN T1.'Status' = "OLD" THEN "Yellow"
ELSE "Grey"
END
+"}" + T1.'Comments' + "{cell}")
AS 'Comments'
From T1