How to keep your References or Terms consistent

Problem Statement

Let’s assume you have some data that can be kept as a table in Confluence (for example, a list of various references). Now, you would want to include references from this table into various other pages and yet you want only the relevant references to appear on each of the pages.

As well, you would want to have an ability to update the table and be sure that all the documents would have the updated data.

Solution

You can easily achieve this using SQL-Powered Table Transformer plugin for Confluence, here is a recipe:

  1. Create a Source Page where you will put your Source Table with all the References

  2. Create the References Source Table on this page and place it into the Excerpt macro container.

  3. Save the Source Page

  4. Now, open a Target page where you want to put the relevant references from the Source Page.

  5. Insert SQL-Powered Table Transformer macro container into the Target Page

  6. Insert an “Excerpt Include” macro container into the SQL-Powered Table Transformer macro container.

  7. Edit the properties of the “Excerpt Include” container and configure it to include the Table from the Source Page, save the macro (make sure “Remove Surrounding Panel” option is checked).

  8. Now, edit the properties of the SQL-Powered Table Transformer macro container:
    1. put the following SQL into the “SQL Query” field:

    1 2 3 CREATE TABLE TABLE_T AS SELECT * FROM table_1 WHERE LABELS LIKE '%|Target-DOC-2|%'; ALTER TABLE TABLE_T DROP COLUMN LABELS; SELECT * FROM TABLE_T

    2. put the “;” into the “Query Splitter” field
    3. save the macro container configuration
    Here is what you should now have on the Target Page

  9. Save the Target Page.

  10. When done, you should see in your Target Page a table with only reference [1]:

Let’s say you now want the reference [2] also to appear on your Target Page. To achieve this, you just need to edit the Source Page and append “Target-DOC-2|” into the Labels column of the reference [2], then save the page. From now on, reference [2] should also appear in the Target Page.

If you update your Source Page table, the data will be always updated on all the Target Pages too.

Surely, you could follow the same approach for any kind of data, for example, “Acronyms”, “Terms”, etc.