I'm having issues trying to colour a table row automatically based on the value of a cell.
I am wrapping a table in the Table Transformer macros and I'm bad with SQL :P
Basically, I'm wanting to change the colour of a whole row when either 'Fail', 'Partial' or 'Pass' is added to the second column.
Better yet, would it be possible to get the status of my Xray test execution result and change the row based on that status?
See my table below, thanks in advance.
Hi @Chad Waldron ,
Wrap your table into the two Table Transformer macros subsequently:
The internal Table Transformer macro will be used to fulfill empty cells if there are any in your source table - so that they will be colored beautifully later:
SELECT
CASE WHEN T1.'Fail/Partial' IS NULL THEN "-"
ELSE T1.'Fail/Partial'
END
AS 'Fail/Partial',
CASE WHEN T1.'Column 1' IS NULL THEN "-"
ELSE T1.'Column 1'
END
AS 'Column 1',
CASE WHEN T1.'Column 2' IS NULL THEN "-"
ELSE T1.'Column 2'
END
AS 'Column 2'
FROM T1
The external Table Transformer is used for conditional formatting:
SELECT
FORMATWIKI("{cell:bgColor=" +
CASE WHEN T1.'Fail/Partial' = "Fail" THEN "#FFA07A"
WHEN T1.'Fail/Partial' = "Partial" THEN "#ADD8E6"
WHEN T1.'Fail/Partial' = "Pass" THEN "#9FE2BF"
ELSE "#D3D3D3"
END
+ "}" + T1.'Fail/Partial' + "{cell}")
AS 'Fail/Partial',
FORMATWIKI("{cell:bgColor=" +
CASE WHEN T1.'Fail/Partial' = "Fail" THEN "#FFA07A"
WHEN T1.'Fail/Partial' = "Partial" THEN "#ADD8E6"
WHEN T1.'Fail/Partial' = "Pass" THEN "#9FE2BF"
ELSE "#D3D3D3"
END
+ "}" + T1.'Column 1' + "{cell}")
AS 'Column 1',
FORMATWIKI("{cell:bgColor=" +
CASE WHEN T1.'Fail/Partial' = "Fail" THEN "#FFA07A"
WHEN T1.'Fail/Partial' = "Partial" THEN "#ADD8E6"
WHEN T1.'Fail/Partial' = "Pass" THEN "#9FE2BF"
ELSE "#D3D3D3"
END
+ "}" + T1.'Column 2' + "{cell}")
AS 'Column 2'
FROM T1
In my queries I took exactly your column's name T1.'Fail/Partial' for the conditions, but the T1.'Column 1', T1.'Column 2', etc. should be changed for your own headers (and you should repeat the same pattern for all the columns of your table).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.