Table Transformer - Format row background colour if its from T1, T2...Tn
Asked by Aleks Irinics:

Hi all

I am new to SQL and Table formatting, and paving my knowledge but got stuck with the following:

I collating information from multiple tables (around 40) into a single one based on the condition (pretty simple so far). However, I realised as the result table will be quite big, it would be helpful to identify information coming from input tables. I am looking for something like this (see excel example). So Odd tables are highlighted and even are kept as is.

Any help if appreciated. Thank you very much.

Aleks

![Capture.PNG](/t5/image/serverpage/image-id/225974i1CF2ED3BA64C25FB/image-size/large?v=v2&px=999 "Capture.PNG")


Answers:
author: Natalie Paramonova [Stiltsoft]
body: Hi [@Aleks Irinics](/t5/user/viewprofilepage/user-id/4918515) ,

To color rows coming from different tables, we may suggest adding an optional column to every table indicating its belonging. For example, name it as a "Source table" and put the T1, T2, T3,... Tn in the cells.

Then you may merge/transform the master report with the first Table Transformer macro and then use the second Table Transformer macro to color your rows based on the contents of the "Source table" column. And don't forget to use the [Table Toolbox](https://docs.stiltsoft.com/display/TFAC/How+to+use+Table+Toolbox+macro?utm_source=atl_community&utm_medium=answer&utm_campaign=table-filter-traffic-sources&utm_vendorID=1216111) to nest macros as your hosting is Cloud.

[Here is an example](https://docs.stiltsoft.com/display/TFAC/Advanced+table+cells+formatting#Advancedtablecellsformatting-Conditionalinsertingofvaluesandcoloringcellsbackground?utm_source=atl_community&utm_medium=answer&utm_campaign=table-filter-traffic-sources&utm_vendorID=1216111) how to color background based on conditions.

Then you may use the Table Filter macro (again inside the Table Toolbox macro) and hide the unwanted "Source table" column.If this is not the case, here is an example of an alternative row coloring that may also help to make your big tables easy-to-read:  

![Wed 9-1.png](https://community.atlassian.com/t5/image/serverpage/image-id/226401iC481D627E128A048/image-size/large?v=v2&px=999 "Wed 9-1.png")  

![Wed 9-2.png](https://community.atlassian.com/t5/image/serverpage/image-id/226402i9D75F6D804C93223/image-size/large?v=v2&px=999 "Wed 9-2.png")  

![Wed 9-3.png](https://community.atlassian.com/t5/image/serverpage/image-id/226403iED11888731AEAAAE/image-size/large?v=v2&px=999 "Wed 9-3.png")

SELECT  
FORMATWIKI("{cell:bgColor=" + 'Color' + "}", 'Description', "{cell}") AS 'Description',  
FORMATWIKI("{cell:bgColor=" + 'Color' + "}", 'Additional notes', "{cell}") AS 'Additional notes',  
FORMATWIKI("{cell:bgColor=" + 'Color' + "}", 'Source', "{cell}") AS 'Source'  
FROM  
(SELECT \*,  
CASE  
WHEN 'Row No.'%2 = 0 THEN "#DEEBFF"  
ELSE "white"  
END AS 'Color'  
FROM (SELECT \*, ROWNUM(\*) AS 'Row No.'  
FROM T1))

![Wed 9-4.png](https://community.atlassian.com/t5/image/serverpage/image-id/226404iF8384A518F70DEE1/image-size/large?v=v2&px=999 "Wed 9-4.png")

Hope this helps.

comments: author: Dhiraj Kr_ Gupta
body: Can you help me for removing vertical lines separating column


author: Stiltsoft support
body: Hi [@Dhiraj Kr_ Gupta](/t5/user/viewprofilepage/user-id/5375074) ,

As the Table Transformer macro treats source tables as mini databases, it draws borders around your cell contents. But you can color them white and make them "invisible".

The first option is to use the following SQL query:

SELECT  
FORMATWIKI("{cell:border-color=white}", 'Column 1' + "{cell}") AS 'Column 1',  
FORMATWIKI("{cell:border-color=white}" + 'Column 2' + "{cell}") AS 'Column 2'  
FROM T\*

And the second option is to use the **Stylesheet tab** of the macro:

td {border-color:white}

The result will be the same:

![Thu 7-1.png](https://community.atlassian.com/t5/image/serverpage/image-id/324121iB510D618979ED387/image-size/large?v=v2&px=999 "Thu 7-1.png")

Hope it helps your case.


author: Dhiraj Kr_ Gupta
body: Thanks for your support, td stylesheet macro worked.

How to make appearance of row color alternative like blue row then white and so on..


author: Stiltsoft support
body: And another CSS for the Stylesheet tab from our developers to remove only vertical lines from your table:

<br />

.confluenceTh, .confluenceTd {  
border: none;  
border-bottom: 1px solid #C1C7D0;  
}

![Thu 9-1.png](https://community.atlassian.com/t5/image/serverpage/image-id/324143i2AD84A2010692EF8/image-size/large?v=v2&px=999 "Thu 9-1.png")

To color your rows alternatively, you may use the following SQL query:

SELECT

FORMATWIKI("{cell:bgColor=" + 'Color' + "}", 'Column 1', "{cell}") AS 'Column 1',

FORMATWIKI("{cell:bgColor=" + 'Color' + "}", 'Column 2', "{cell}") AS 'Column 2'

FROM

(SELECT \*,

CASE

WHEN 'Row No.'%2 = 0 THEN "#DEEBFF"

ELSE "white"

END AS 'Color'

FROM (SELECT \*, ROWNUM(\*) AS 'Row No.'

FROM T1))

Hope it helps your case.


author: Dhiraj Kr_ Gupta
body: Through sql, it is working but it makes the link in the field simple text/ and some become invalid. Thus it will not work for me. Please give me any stylesheet Alternative


author: Stiltsoft support
body: The query should be working fine and preserve your initial cell formatting:

![Thu 9-2.png](https://community.atlassian.com/t5/image/serverpage/image-id/324157iD810BABD681B9EC6/image-size/large?v=v2&px=999 "Thu 9-2.png")

The links may break if you use plusses instead of commas:

FORMATWIKI("{cell:bgColor=" + 'Color' + "}" **+** 'Column 1' **+** "{cell}") AS 'Column 1',

The variant from the previous reply uses commas that preserve initial cell formatting:

FORMATWIKI("{cell:bgColor=" + 'Color' + "}"**,** 'Column 1'**,** "{cell}") AS 'Column 1',


author: Dhiraj Kr_ Gupta
body: Thank You very much


Tags: cloud

confluence-cloud

filter

table

table-filter

table-filter-and-charts

table-filter-charts-spreadsheets

table-transformer