{expanding-reporter}
Plugin: Reporting Plugin, from version 3.0.0
This is a reporter which can expand on a items returned from another, contained reporter.
Description
This reporter will expand on a list of sub-items in the original report. See the examples for more information.
Usage
Parameters
| Name |
Required |
Default |
Description |
| [default]/key | | | The key that will be retrieved from each item in the contained report. If it is a list, this reporter will return an Expanded result for each of the items in that list. If it is a single item, a single Expanded result will be returned. If it is empty, the result will depend on whether the 'requireValue' parameter is true or false. See 'requireValue' for details. |
| as | | | The name to set each expanded item as when accessing it in the report. May not be 'item', as this is reserved for the original item being expanded. |
| matchAll | | true | If set to 'false', content matching any of the criteria will be returned. Otherwise, the content must match all criteria. |
| allowEmpty | | false | If set to true, the parent item will still be returned even if the specified key value is empty. |
 | Note This macro replaces the expand-on macro present prior to Reporting 3.0.0 |
Below is an example of converting from expand-on to expanding-reporter. It is a simple report which will output the children of the current page who have comments, as well as the the first 50 characters of each comment, in reverse date order.
Using expand-on
Using expanding-reporter
Things to note
- expanding-reporter is around the original report, not inside it.
- The text-sort was moved into the expanding-reporter. The reason for this is that expanding does its own sorting on the whole result set. In this case, it makes more sense to group comments by the parent page first, then by their creation date. In other places, you may not want to do that.
- The 'expanded:item' and 'expanded:comment' keys are exactly the same as before. The expanding-reporter outputs the same structure as expand-on.
How do I access multiple {repeating-data} objects in a scaffold?
Requirements: {repeating-data:requirements} {list-data:requirement} {list-option:1}1{list-option} {list-option:2}2{list-option} {list-data} {repeating-data} | Dependencies: {repeating-data:dependencies} {list-data:dependency} {list-option:z}z{list-option} {list-option:y}y{list-option} {list-data}At first glance, it looks like expanding-reporter ties to a specific repeating-data key, so in the above example I'd only be able to expand on either requirements OR dependencies, but not both in the same report (e.g. a report that displays the page name, requirements, and dependencies).
This is correct, however you can use the combining-reporter to join two expanding-reporters together. Eg:
{combining-reporter} {expanding-reporter:data:requirements|as=record} {local-reporter:content:children} {expanding-reporter} {expanding-reporter:data:dependencies|as=record} {local-reporter:content:children} {expanding-reporter} {combining-reporter}This would combine the two together, both of which can be accessed via 'expanded:record'.
Thanks for the code. I tried to adapt this, but all I get is "There are no currently projects under review!" from the report-empty line. There are about 15 children pages with priorities assigned. Not all pages have requirements and dependencies defined.
{report-table} {combining-reporter:matchAll=false} {expanding-reporter:data:requirements|as=record} {local-reporter:content:children} {expanding-reporter} {expanding-reporter:data:dependencies|as=record} {local-reporter:content:children} {expanding-reporter} {text-sort:data:priority|order=ascending} {combining-reporter} {report-column:title=Priority}{report-info:data:priority}{report-column} {report-column:title=Effort}{report-info:content:title|link=true}{report-column} {report-column:title=Requirements}{report-info:expanded:record > data:requirement|render=wiki}{report-column} {report-column:title=Dependencies}{report-info:expanded:record > data:dependency}{report-column} {report-empty}| There are no currently projects under review! |{report-empty} {report-table}If you just do a report with one of the individual expanding-reports, does it return a value?
Here are a couple of tweaks, but the won't resolve the 'no records' problem (I'm assuming that 'priority' is one of the fields on each page, not in the table-record):
{report-table} {combining-reporter:matchAll=false} {expanding-reporter:data:requirements|as=record} {local-reporter:content:children} {expanding-reporter} {expanding-reporter:data:dependencies|as=record} {local-reporter:content:children} {expanding-reporter} {text-sort:expanded:item > data:priority|order=ascending} {combining-reporter} {report-column:title=Priority}{report-info:expanded:item > data:priority}{report-column} {report-column:title=Effort}{report-info:expanded:item > content:title|link=true}{report-column} {report-column:title=Requirements}{report-info:expanded:record > data:requirement|render=wiki}{report-column} {report-column:title=Dependencies}{report-info:expanded:record > data:dependency}{report-column} {report-empty}| There are no currently projects under review! |{report-empty} {report-table}Yes, 'priority' is a number-data field on each page.
Using an individual expanding-reporter does not work either. The table displays the priority and content:title if I use the local-reporter, but of course none of the requirements or dependencies are displayed:
{report-table} {local-reporter:content:children} {local-reporter} {report-column:title=#}{report-info:data:priority}{report-column} {report-column:title=Requirements}{report-info:data:requirement|render=wiki}{report-column} {report-column:title=Dependency Links}{report-info:expanded:record > data:dependency}{report-column} {report-column:title=Use Cases}{report-info:data:usecases}{report-column} {report-empty}| There are no currently projects under review! |{report-empty} {report-table}I think I'm going to change the data type to a multi-option select, because I can't seem to figure out how to report on repeating-data elements.
I'm trying to create a report where I list all pages in another space with outgoing links to create a page (e.g. pages that have links to wiki pages that don't exist yet). I'm struggling with getting expanding-reporter to parse through the outgoing links array. Here's my code attempt:
{report-table} {expanding-reporter:content:outgoing links|as=link} {local-reporter:content:descendents|source=AnotherSpace:Home} {text-filter:link:page > content:title|scope=@self|include=.*Subset.*} {text-filter:link:url|include=.*create.*} {expanding-reporter} {report-column:title=Request}{report-info:expanded:item > content:title|link=true}{report-column} {report-empty}There are currently no requests that have not been assigned!{report-empty} {report-table}I have a feeling that 'outgoing links' as defined by the Content supplier only returns links to actual pages, not 'uncreated' pages, so that may be why it's blanking. Try doing a test to see if any even show up with no filtering perhaps?
However, it will probably be more efficient to just use the 'undefined links' key from the Space Supplier. Eg:
{local-reporter:page:space > space:undefined links|source=AnotherSpace:Home} {local-reporter} {report-body}{report-info:link:body|link=true}{report-body}{report-body}Thanks for the tip. I think undefined links will be the way to go, however, the code you provided above doesn't return anything. I don't think I completely understand the key chain above. How does local reporter know to search all of the decendents of the source value (e.g. content:decendents)? Could that be why I'm not seeing any results? Perhaps I need to use content-reporter rather than local-reporter?
The chain above ("page:space > space:undefined links") is actually getting space of the 'AnotherSpace:Home' page, then getting the undefined links in that space as a whole, not for each page individually. Do you need the list of links, or the pages that contain the undefined links. If the latter, I'm not sure if it can be done presently...