Combine Tables from Child Pages
It is sometimes helpful to pull information from a child page into a parent page. One way to do this is with the excerpt macro.
However, excerpt can’t pull multiple data points out of multiple tables and then get reformatted on the parent page. The code below was written to pull weekly status report info from individual reports and combine them into a team report automatically, using the Scaffolding macro:
Notes regarding the above code
- The character sequence: "\\\\u007c" is how to put a pipe ‘|’ in the regular expression (the hex value escaped threefold). Confluence tables use a lot of pipes, so this part is important.
- The regular expression evaluates lines with pipes and pulls out the strings between the pipes into regular expression groups.
- The expanding reporter leverages “text:find” to create the return list that this reporter requires.
- The parentheses in the regular expression pass regular expression groups down through the “?report-info” that can then be accessed with “match:group.” The expanding reporter is a wrapper for the “report-info.”
- “render=wiki” will keep unwanted bits in the markup from appearing.
- This regular expression uses a positive lookahead to make sure it’s pulling from the correct table. A negative lookahead may also be used in case the child page has many tables. (“lookahead” documentation: http://www.regular-expressions.info/lookaround.html)
- The use of space template pages on the child pages is essential here for the regular expression to trigger correctly.
Trouble viewing the documents available on this page? Download the Adobe PDF Reader.
Last updated July 25, 2013 @ 1:19 pm