Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,293,733
Community Members
 
Community Events
165
Community Groups

Want to colour a table row automatically based on the value of a cell

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.

 

table.png

1 answer

Hi @Chad Waldron ,

Wrap your table into the two Table Transformer macros subsequently:

Tue 6-1.png

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

Tue 6-2.png

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

Tue 6-3.png

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). 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

Confluence: Where work and wellness meet

Feeling overwhelmed by the demands of work and life? With a 25% increase in the prevalence of anxiety and depression worldwide during the pandemic, for most of us, it’s a resounding yes . 🙋‍♀️ ...

762 views 5 21
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you