I have a table that is build from data coming from an outside source. I want each row to be colored in a color that is comming from a column named Color, which contains RGB value of a color.
Is this possible?
Hi @Alexander Stoyanov ,
You may try the Table Filter and Charts for Confluence app.
Wrap you table in the Table Transformer macro and apply conditional formatting with the help of the Wiki markup:
Type in your custom SQL query:
SELECTFORMATWIKI("{cell:bgColor=" +CASE WHEN T1.'Color' LIKE "(122,28,134)" THEN "#7a1c86"WHEN T1.'Color' LIKE "(10,186,181)" THEN "#0abab5"ELSE "#ccff00"END+ "}" + T1.'Column A' + "{cell}") AS 'Column A with Background',FORMATWIKI("{cell:bgColor=" +CASE WHEN T1.'Color' LIKE "(122,28,134)" THEN "#7a1c86"WHEN T1.'Color' LIKE "(10,186,181)" THEN "#0abab5"ELSE "#ccff00"END+ "}" + T1.'Column B' + "{cell}") AS 'Column B with Background',FORMATWIKI("{cell:bgColor=" +CASE WHEN T1.'Color' LIKE "(122,28,134)" THEN "#7a1c86"WHEN T1.'Color' LIKE "(10,186,181)" THEN "#0abab5"ELSE "#ccff00"END+ "}" + T1.'Color' + "{cell}") AS 'Color with Background'FROM T*
And preview the result:
And what concerns uploading your source table from the external source, the app also provides the Table from CSV and Table from JSON macros that support outputting data from a URL or an attached file.
Thanks for the replay @Katerina Kovriga _Stiltsoft_ . It looks very promising and I was not aware of the table transformer macro. When I paste your code with the sample table you have provided I get
TypeError: alasql.fn.FORMATWIKI is not a function
Where is FORMATWIKI defined?
I get TypeError: alasql.fn.FORMATWIKI is not a function as well.
@Alexander Stoyanov , @Dom , please, check if the version of the Table Filter and Charts for Confluence app is 6.1.0 or newer.
Here is our documentation about cells formatting with the Table Transformer macro. You'll find a lot of use cases there.
If the version of the app is up-to-date but you still can't reproduce our examples, please, raise a support ticket (specify the version of the app and attach your screenshots, we'll investigate the issue).
It looks like you're new here. Sign in or register to get started.