How to combine content of two different tables into one table?
Asked by TomTom:

Hi!

Is it possible to combine the content of two or more different tables across different spaces into one "Master" table? All the tables have the same columns/titles, what I want to do is to aggregate all the content on one overview page/table.

I am playing around with excerpts, the reporting plugin and the meta-data plugin for quite a while now, but I can't figure it out.

Thanks for your help!  
Cheers,  
Tom


Answers:
author: Katerina Kovriga {Stiltsoft}
body: You can also try the [Table Filter and Charts for Confluence](https://marketplace.atlassian.com/apps/27447/table-filter-and-charts-for-confluence?hosting=cloud&tab=overview) app (it's available for Cloud, Server and Data Center instances).

At first you need to reuse your mini tables and "collect" them on the required page with the help of the [Table Excerpt and Table Excerpt Include](https://docs.stiltsoft.com/display/public/TFAC/How+to+use+Table+Excerpt+and+Table+Excerpt+Include+macros) macros.

The second step is to merge your tables and create one master table. This task can be easily accomplished with the help of the [Table Transformer](https://docs.stiltsoft.com/display/public/TFAC/How+to+use+Table+Transformer+macro) macro.

If you have the same colums/titles in your mini tables, you should choose the default [merge tables preset](https://docs.stiltsoft.com/display/public/TFAC/Default+automatic+presets) and everything will be done automatically.

If you need to perform complex operations with your tables, you can use custom SQL queries to achieve even more.


author: George Ivanov
body: it looks that what you are asking can be achieved using the [SQL-Powered Table Transformer](https://marketplace.atlassian.com/apps/1219300/sql-powered-table-transformer?hosting=server&tab=overview) macro. Add all your tables into the SQL-Powered Table Transformer macro container using Excerpt Include macro (for each). Then edit the SQL-Powered Table Transformer macro properties, click the SQL tab, then edit the SQL Query:

SELECT \* FROM table_1 UNION SELECT \* FROM table_2 ... UNION SELECT \* FROM table_\<n\>

where n-is the number of your tables inserted.

This will combine all the tables in the output using the "SQL Query" editor

Apart from UNION you can do all other sort of things with the tables that SQL allows (MERGE, MINUS, etc, etc.)


author: Marcin Miko?ajczak
body: Unfortunately there doesn't seem to be any way to combine 2 Page Properties macros or even 2 tables in 1 Page Properties macro to show them as 1 entry in a Page Properties Report.

Please comment and vote on [CONF-30881](https://jira.atlassian.com/browse/CONF-30881)


author: BillA
body: You could use the [page properties](https://confluence.atlassian.com/display/DOC/Page+Properties+Macro) and [page properties report](https://confluence.atlassian.com/display/DOC/Page+Properties+Report+Macro) macros which you can think of as an excerpt-include macro for tables. The only caveat is that it won't work across pages in different spaces.

The Requirements Blueprint uses these macros so if you're on Confluence 5.1, can see how this work in the Requirments Blueprint.

comments: author: Jeanette Wheeler
body: Thx. Will give it a try. I am upgrading instance to Confluence 5.

I did look at page properties but wasn't sure if appropriate. On each page I have table with 6 fields, one of which is audio attachment. Pages with same identifier (could be another field or page property) are aggregated into one summary table. We used to do this via Scaffolding \& Reporting plugins but felt it should be possible within Confluence.


author: TomTom
body: Thanks for the answers so far!

Unfortunately, we are still on Confluence 4.

Is there any other solution that does not require the Scaffolding plugin and does work across different spaces?


author: Jeanette Wheeler
body: I have same problem so interested in solution that does not require scaffolding plugin.


author: Jeanette Wheeler
body: I have same problem so interested in solution that does not require scaffolding plugin.


Tags: excerpt

merge

metadata

report

table