How can I report on table-data or repeating-data?
If I enter data using the {table-data} or {repeating-data} from Scaffolding, can I report on them with the Reporting Plugin?
2
people have this question
I have this question, too!
Tell me when someone answers.
The more people who ask this question, the more it gets noticed.
The more people who ask this question, the more it gets noticed.
The best answer from the company
-
Both are available, and are accessed as lists. As such, you actually need to do a sub-report on it. The trick is that because of how Confluence renders macros, the sub-report can't be the same as the outer report (i.e. you can't have a report-list inside another report-list, but you can have a report-table). To get around this you can use {report-block-1}, {report-block-2}, etc, or similar for {report-table} and {report-list}.
For example, you have several pages with the following structure:
{repeating-data:Key targets & strategy}
| {text-data:Key target|type=area|width=300px|height=100px}Key target{text-data} | {text-data:Strategy|type=area|width=300px|height=100px}Strategy how the target is achieved{text-data} | {list-data:Strategy focus area}
{list-option}Area 1{list-option}
{list-option}Area 2{list-option}
{list-option}Area 3{list-option}
{list-option}none{list-option}
{list-data} |
{repeating-data}
You can then report on it from the parent page like so:
{report-block}
{local-reporter:content:children}
{report-body}
h2. {report-info:content:title|link=true}
*Details:* {report-info:data:Details}
h3. Key targets & strategies
{report-table}
{current-item-reporter:data:Key targets & strategies}
{report-column:title=Key target}{report-info:data:Key target}{report-column}
{report-column:title=Strategy}{report-info:data:Strategy}{report-column}
{report-table}
{report-body}
{report-block}
As an alternative to the internal report-table, you could use the report-on macro, which will loop through any items in a list. E.g.:
{report-on:data:Key targets & strategies}
*Key target:* {report-info:data:Key target}
*Strategy:* {report-info:data:Strategy}
{report-on}
I’m happy
The company says
this answers the question
-
Inappropriate?Both are available, and are accessed as lists. As such, you actually need to do a sub-report on it. The trick is that because of how Confluence renders macros, the sub-report can't be the same as the outer report (i.e. you can't have a report-list inside another report-list, but you can have a report-table). To get around this you can use {report-block-1}, {report-block-2}, etc, or similar for {report-table} and {report-list}.
For example, you have several pages with the following structure:
{repeating-data:Key targets & strategy}
| {text-data:Key target|type=area|width=300px|height=100px}Key target{text-data} | {text-data:Strategy|type=area|width=300px|height=100px}Strategy how the target is achieved{text-data} | {list-data:Strategy focus area}
{list-option}Area 1{list-option}
{list-option}Area 2{list-option}
{list-option}Area 3{list-option}
{list-option}none{list-option}
{list-data} |
{repeating-data}
You can then report on it from the parent page like so:
{report-block}
{local-reporter:content:children}
{report-body}
h2. {report-info:content:title|link=true}
*Details:* {report-info:data:Details}
h3. Key targets & strategies
{report-table}
{current-item-reporter:data:Key targets & strategies}
{report-column:title=Key target}{report-info:data:Key target}{report-column}
{report-column:title=Strategy}{report-info:data:Strategy}{report-column}
{report-table}
{report-body}
{report-block}
As an alternative to the internal report-table, you could use the report-on macro, which will loop through any items in a list. E.g.:
{report-on:data:Key targets & strategies}
*Key target:* {report-info:data:Key target}
*Strategy:* {report-info:data:Strategy}
{report-on}
I’m happy
The company says
this answers the question
-
Is it possible to filter on table-data? I have a table of meeting actions, that I have used table-data to create. Each row has an Action and a Person. What I would like to do is report all of the Actions from this data-table, that have a Person of 'X'. That way I can show outstanding actions for specific people. -
There are a couple of options. In particularly, you will probably want either the {expanding-reporter} or the {colleciton-filter}, depending on what else you want to display. An example of {expanding-reporter} is below - just adapt it to your example and add a user-filter for 'data:Person'. Alternately, use the {collection-filter} to test if the page even has any action entries for the specified person. Something like:
{local-reporter:children}
{collection-filter:data:Actions|matchItems=any}
{user-filter:data:Person > reference:value|user=xxx}
{collection-filter}
{local-reporter}
This will allow the 'child' to be displayed if any of the 'Actions' have a 'Person' named 'xxx'. -
Hi David, thanks for the quick response. I couldn't get this to work. Although the {collection-filter} does show the report because one of the items matches the requested item, the expanding-reporter version didn't produce any data. My code looks like this:
{report-table}
{expanding-reporter:data:Actions|as=attrib}
{local-reporter:content:children}
{user-filter:data:Person > reference:value|user=Martin}
{local-reporter}
{expanding-reporter}
{report-column:title=Action}{report-info:expanded:attrib> data:action}{report-column}
{report-column:title=Person}{report-info:expanded:attrib > data:person}{report-column}
{report-table}
If I take out the {user-filter} then I get all 4 rows:
Buy Lunch Rebecca
Eat Lunch Martin
Dispose of rubbish Robert
Sleep George
All I want to see though is the one row for 'Martin'
Thanks -
You need to put the {user-filter} outside the {local-reporter}, but still inside the {expanding-reporter}. Because the 'data:Person' is an item in the 'data:Actions' table, it is only available inside the {expanding-reporter}. -
BINGO!! Many thanks, it would have taken me ages to work that out. -
One last question about this (I promise, well, hopefully), is there anyway to report a count of the items that meet the filter for the table-data? -
Use the 'summaryType', 'summaryFormat' and 'summaryValue' options of the {report-column} macro. The summaryType you are after would be 'count'. -
I'm a confluence newbie. I've managed to get my forms going but no joy with the reporting .... I've tried a few versions of your comments but get no data. Here's is my dump of my code....hope you can help.
{scaffold:Test Data}
{repeating-data:Value Flows}
Deliverable:
{text-data:Deliverable}
{text-data}
Description/Example:
{text-data:Description/Example|type=area|width=300px|height=75px}
{text-data}
Tangible/Intangible?
{list-data:Tangible or Intangible|type=check}
{list-option:Tangible}
Tangible
{list-option}
{list-option:Intangible}
Intangible
{list-option}
{list-data}
Role accountable for delivery:
{text-data:Role accountable for delivery}
{text-data}
Role primarily receiving:
{text-data:Role primarily receiving}
{text-data}
Cost/Risk to deliver? (Only select for value flows you are creating)
{list-data:Cost/Risk to deliver}
{list-option:1(Low)}
1
{list-option}
{list-option:2}
2
{list-option}
{list-option:3}
3
{list-option}
{list-option:4}
4
{list-option}
{list-option:5(High)}
5
{list-option}
{list-data}
Potential value received? (Only select for value flows you are receiving)
{list-data:Potential value received}
{list-option:1(Low)}
1
{list-option}
{list-option:2}
2
{list-option}
{list-option:3}
3
{list-option}
{list-option:4}
4
{list-option}
{list-option:5(High)}
5
{list-option}
{list-data}
{repeating-data}
{scaffold}
{report-table}
{content-reporter}
{report-column:title=From}
{report-info:item:Role accountable for delivery}
{report-column}
{report-column:title=To}
{report-info:item:Role primarily receiving}
{report-column}
{report-column:title=Value Flow}
{report-info:item:Deliverable}
{report-column}
{report-column:title=Tangible or Intangible}
{report-info:item:Tangible or Intangible}
{report-column}
{report-column:title=Cost}
{report-info:item:Cost/Risk to deliver}
{report-column}
{report-column:title=Value}
{report-info:item:Potential value received}
{report-column}
{report-empty}
This is displayed if no results are returned by the reporter.
{report-empty}
{report-table}
{report-on:data:Value Flows}
From:
{report-info:data:Role accountable for delivery}
To:
{report-info:data:Role primarily receiving}
Value Flow:
{report-info:data:Deliverable}
Tangible or Intangible:
{report-info:data:Tangible or Intangible}
Cost:
{report-info:data:Cost/Risk to deliver}
Value:
{report-info:data:Potential value received}
{report-on} -
Hi IIlockee,
Would you mind creating this as a new question, and being a little more specific on what you want it to do? This question page is getting a bit out of hand :) -
Inappropriate?Another tip from Stephen Morad:
You can also use {expanding-reporter} like so:
{report-table}
{expanding-reporter:data:Key targets & strategies|as=attrib}
{local-reporter:content:children}
{local-reporter}
{expanding-reporter}
{report-column:title=Name}{report-info:expanded:item > data:name}{report-column}
{report-column:title=Key Target}{report-info:expanded:attrib > data:Key target}{report-column}
{report-column:title=Strategy}{report-info:expanded:attrib > data:Strategy}{report-column}
{report-table}
This allows "parent" information (e.g. 'name' in the example above) to be included with the same table as table-data or repeating-data values. -
Inappropriate?Note: References to {current-item-reporter} above should be replaced with {local-reporter}.
-
Inappropriate?Hi,
I've recently posted this question on the Atlassian forum too (http://forums.atlassian.com/thread.js...). Many views but no answers for now!
I've followed the examples given previously in this thread, but if my scaffolding template uses a {group-data} section, how does this change the syntax for referring to a data item within the repeating block? My report produces column headings but no actual data.
Would I be best to just drop the idea of using {group-data}? In the example I'm working on, which is a weekly report, I envisaged distinct sections and using {group-data} to support this. I.e. a section for "project progress", one for "whereabouts next week", another for "issues", etc.
Thanks,
Charles -
To refer to content inside a {group-data} macro you have two options:
1. Just add the {group-data} name in front of your other property. Eg: {report-on:data:WikiReport.ReportItem}{report-info:data:txtProject}{report-on}
2. Use a 'key chain' to access the contents. Eg: {report-on:data:WikiReport > data:ReportItem}{report-info:data:txtProject}{report-on}
Not much difference in syntax really - personal taste.
That said, I very rarely actually use {group-data} personally. The main case is if I have similar 'group-data' sections and want to copy-n-paste the markup. You can just wrap a {report-on:data:MyGroup} around the markup and it will work on a different group. -
Inappropriate?Hi David,
Thanks for your reply. I think I'd like to stick with using {group-data}, so I've implemented your suggestion on using the {report-on:data:WikiReport.ReportItem}. This does succeed in pulling out the appropriate data, but in my table I end up with just one row per page, with the values from the repeating data fields concatenated together in each cell (columns 1 and 2). So it's not quite right. What I need is one row per repeating item.
Here's what my report looks like now:
{roundrect:bgcolor=#dbcee2}
{report-block}
{report-table}
{local-reporter:content:children|source=Reports2}
{date-sort:content:modification date|order=descending}
{date-filter:content:modification date|minValue=-6d}
{local-reporter}
{report-column:title=Project}{report-on:data:WikiReport.ReportItem}{report-info:data:txtProject}{report-on}{report-column}
{report-column:title=Detail}{report-on:data:WikiReport.ReportItem}{report-info:data:txtDetail}{report-on}{report-column}
{report-column:title=Submitted by}{report-info:content:modification date|format=dd MMM @ h:mm a|link=true} by
{report-info:content:modifier|link=true}.{report-column}
{report-empty}_No reports available from the last 7 days._{report-empty}
{report-table}
{report-block}
{roundrect}
I guess one complication is that the author name and modification date are properties of the page, not the repeating item. These elements are displayed correctly for now (column 3), but would I be right in thinking that there should be a local-reporter before the {report-table} so that the table is made aware of the repeating element?
Thanks,
Charles -
Inappropriate?Hi,
Phew! I got the solution by incorporating the {expanding-reporter} macro. Here's the source for my completed report in case it helps any one else:
{roundrect:bgcolor=#dbcee2}
{report-block}
{report-table}
{expanding-reporter:data:WikiReport.ReportItem|as=attrib}
{local-reporter:content:children|source=Reports2}
{date-sort:content:modification date|order=descending}
{date-filter:content:modification date|minValue=-6d}
{local-reporter}
{expanding-reporter}
{report-column:title=Project}{report-link:expanded:item > content:url}{report-info:expanded:attrib > data:txtProject}{report-link}{report-column}
{report-column:title=Detail}{report-link:expanded:item > content:url}{report-info:expanded:attrib > data:txtDetail}{report-link}{report-column}
{report-column:title=Submitted by}{report-info:expanded:item > content:modification date|format=dd MMM @ h:mm a|link=true} by
{report-info:expanded:item > content:modifier|link=true}.{report-column}
{report-empty}_No reports available from the last 7 days._{report-empty}
{report-table}
{report-block}
{roundrect}
I’m so pleased I got this working!
-
Yep, that's pretty much what I would have suggested. Nice work :) -
Inappropriate?Hi David,
Glad you approve. One final twist has cropped up now though. I'd like to be able to sort on the data so that the rows are ordered by a particularly scaffold data field, (txtProject) rather than the date order I have specified in my previous post.
I've tried all sorts of ways of expressing this, and searched for more help, but all to no avail. I'm thinking along the lines of this:
{text-sort:data:txtProject}
or even
{text-sort:attrib > data.txtProject}
Can you offer any pointers on whether this is possible and how it might be achieved please?
Thanks,
Charles -
Inappropriate?You can use the {text-sort} macro as you first suggested, but it needs to be inside the {expanding-reporter}, but outside the inner {local-reporter} - you are sorting on a value in the 'expanded' record, not the original page.
So, something like this:
{expanding-reporter:data:WikiReport.ReportItem|as=attrib}
{local-reporter:content:children|source=Reports2}
{date-sort:content:modification date|order=descending}
{date-filter:content:modification date|minValue=-6d}
{local-reporter}
{text-sort:data:txtProject}
{expanding-reporter}
-
Inappropriate?Hi,
Your explanation makes perfect sense, but I've implemented the change and it's not producing the desired sort result. My test data consists of 2 pages, each with 3 repeating elements. The txtProject field values are "Project 1", "Project 2", "Project 3" (all in page 1), then "111", "AAA" and "ZZZ" (all in page 2).
The order I have listed them here is the order they appear in the table, so I know the sort's not working as we think it should.
I've tried variations with "attrib" and "WikiReport.ReportItem", but always with the sort outside of the inner {local-reporter}. No success though.
Here's my reporting code:
{roundrect:bgcolor=#dbcee2}
{report-block}
{report-table}
{expanding-reporter:data:WikiReport.ReportItem|as=attrib}
{local-reporter:content:children|source=Reports2}
{date-filter:content:modification date|minValue=-6d}
{local-reporter}
{text-sort:data:txtProject}
{expanding-reporter}
{report-column:title=Project}{report-link:expanded:item > content:url}{report-info:expanded:attrib > data:txtProject}{report-link}{report-column}
{report-column:title=Detail}{report-link:expanded:item > content:url}{report-info:expanded:attrib > data:txtDetail}{report-link}{report-column}
{report-column:title=Submitted by}{report-info:expanded:item > content:modification date|format=dd MMM @ h:mm a|link=true} by
{report-info:expanded:item > content:modifier|link=true}.{report-column}
{report-empty}_No reports available from the last 7 days._{report-empty}
{report-table}
{report-block}
{roundrect}
Apologies for taking up your time with the evolving requirements of this report. Hopefully though this will server as a useful template for future work with Reporting. -
Inappropriate?Ok, dug into it a bit and it turns out there is a bug in {expanding-reporter}. A recent updated added lazy-loading for efficiency, but unfortunately the implementation wasn't correctly accounting for sorting, which must take place across the whole set, not just the sub-items for each item. I've created a bug report. Hopefully I'll have time to fix the issue for the next release (coming soon!).
-
Hi,
We found a work-around for the bug. It seems that if you put a combining-reporter around the expanding-reporter tags, and just after the closing expanding-reporter you specify a sort then this executed correctly and gives the desired result. -
Inappropriate?I have the same scenario...I have a meeting Mins Template (so each meeting has it's own page), on each template is a 'table-data', see code:
{table-data:ActionsTable|initialRows=1}
||Action Items || Person Responsible || Deadline|| Priority || Status || Comments ||
| {text-data:ActionITEMs|type=area|width=300px|height=50px} {text-data} | {text-data:Person|width=145px} {text-data} | {date-data:DueDate|format=MMM-dd-yyyy|minYear=2008} | {list-data:ItemPriority}
{list-option}{list-option}
{list-option:Urgent}(!) Urgent{list-option}
{list-option:High}High{list-option}
{list-option:Medium}Medium{list-option}
{list-option:Low}Low{list-option}{list-data} | {list-data:ItemStatus}
{list-option}{list-option}
{list-option:Planned}(*b) Planned{list-option}
{list-option:Delayed}(*r) Delayed{list-option}
{list-option:In Progress}(*y) In Progress{list-option}
{list-option:Completed}(*g) Completed{list-option}{list-data} | {text-data:commentsField|type=area|width=150px|height=50px}{text-data} |
{table-data}
Per your examples above, it does not work. 1.) because you used {current-item-reporter} (I did replace with local-reporter), and also, I need all of the actions from each meeting to appear in 1 large aggregated table.
Report Code I used:
{report-block}
{local-reporter:content:children}
{report-body}
{report-table}
{report-column:title=Meeting Number}{report-info:content:title|link=true}{report-column}
{local-reporter:data:ActionsTable}
{report-column:title=Action}{report-info:data:ActionITEMs}{report-column}
{report-column:title=Responsible}{report-info:data:Person}{report-column}
{report-table}
{report-body}
{report-block}
It puts the actions from Meeting 1 in a table. And put the Actions from Meeting 2 page in a separate table. So now I have 2 tables (each with 2 actions). This doesn't work for me. How to I make it an aggregated table of actions? I've been stuck on this for hours.
I’m frustrated
-
Inappropriate?Hi Kyle,
To aggregate them all into a single table you'll need to use the {expanding-reporter}. There is an example of it in the comments above, but here's a rough example for your case:
{report-table}
{expanding-reporter:data:ActionsTable|as=action}
{local-reporter:content:children}
{date-sort:data:DueDate|order=descending}
{expanding-reporter}
{report-column:title=Meeting Number}{report-info:expanded:item > content:title|link=true}{report-column}
{report-column:title=Action}{report-info:expanded:action > data:ActionITEMs}{report-column}
{report-column:title=Responsible}{report-info:expanded:action > data:Person}{report-column}
{report-table}
Note that there's currently a bug with sorting inside {expanding-reporter} where it doesn't correctly sort across all items, just within the results of each sub-item. There should be a fix for that in the next release, but you'll have to upgrade to Confluence 3.0...
1 person says
this answers the question
-
Hi David,
just to hijack this, since I have a similar issue, and I have tried your solution.
We are creating for each expense report a seperate page, and I would like to display the list of expense reports with their latest status ( {scaffold=expense} data from the document ). However with the code below, I'm getting instead of 1 item, 7 items displayed, and also the scaffold data from the children is not being shown in the table. Any tips?
{report-table}
{expanding-reporter:data:expense|as=documentinfo}
{local-reporter:page:children}
{expanding-reporter}
{report-column:title=Date}{report-info:expanded:item > content:modification date|format=dd MMM @ h:mm a}{report-column}
{report-column:title=Report}{report-info:expanded:item > content:title|link=true}{report-column}
{report-column:title=Creator}{report-info:expanded:item > content:creator}{report-column}
{report-column:title=Status}{report-info:expanded:documentinfo > data:ManagerAuthorised|render=wiki}{report-column}
{report-table}
-
Inappropriate?I could take a stab at it based on what I know. (apparently, not enough ;-)
I am assuming that your reports are child pages of your current page that you are running the report on, if so, I am not sure if this will make a difference, but for your local reporter, I would use "content:children"
Now on your report-columns, look at the code that David sent to me, and compare it to yours. For example, my 1st column has 'expanded:item' because we want to show the title of the page that the info is listed on (and isn't pulling data from the page itself). So the rest of my report columns, I want the text-data values from the pages itself, so I would assume in your case it would be 'expanded:documentinfo > content:title'. (I am looking at what David sent to me, and in the expanding reporter, 'as=action', then my report-info became 'expanded:action', so by substitution, I would assume this is how it works, and probably what you could try in 5 mins.)
Let me know how it comes out.
I’m unsure
-
Inappropriate?Hmm, doesn't seem to have worked. Most of the things mentioned I already had in there - also tried with the content:children before.
You were right in your asumptions. I'm currently editing the "Expenses Page" which has each expense report as a sub-page. I would like to display on the Expenses page a table with 3 page information rows, and one information column with content-data ( list-data ). Now after the update I'm receiving even less info than before.
Additionally an interesting thing is that I'm getting for each expense record approx. 5-8 rows in this table, instead of 1 per each. After a little further research, it creates a seperate row for each data subvalue in the document as it seems.
PS : I suppose the expanding-reporter creates a MySQL JOIN, however how to influence the behavior? Furthermore, is there a way to display all keys and values that are being received per row? ( f.e. a vardump )
I’m frustrated, 2 fruitless days so far
-
Inappropriate?Hi Markus. Could you please post the Scaffold template wiki markup for your 'Expense Report' (the child pages)? That will help with figuring out the right report markup.
With regards to how expanding-reporter works, no SQL is used - it's all pure Java code. The code is in Atlassian's SVN but it's not for the faint-hearted. I can provide a more direct link if you think it will help. -
Inappropriate?Hi David, I have made it work with the following solution :
{report-table}
{local-reporter:content:children}
{report-column:title=Document name}{report-info:content:title|link=true}{report-column}
{report-column:title=Submission date}{report-info:content:creation date|format=dd.MMM @ h:mm a}{report-column}
{report-column:title=Creator}{report-info:content:creator}{report-column}
{report-column:title=Submission date}
{report-block}
{local-reporter:data:expense}
{report-body}
{report-info:data:ManagerAuthorised|render=wiki}
{report-body}
{report-block}
{report-column}
{report-column:title=Last Editor}{report-info:content:modifier}{report-column}
{report-column:title=Last Edit}{report-info:content:modification date|format=dd MMM @ h:mm a}{report-column}
{report-table}
However I don't think that's the way it's supposed to work. Furthermore the table gets ugly, as the report-body inserts a < p > element which requires more line space.
As to your question, the template is a simple expense report template, taken from http://confluence.atlassian.com/displ...
The part I was trying to extract is
{scaffold:expense}
(...)other data(...)
|| Status | {list-data:ManagerAuthorised}
{list-option:Not Yet Authorised}(x) Not Yet Authorised{list-option}
{list-option:Queries Raised with Employee}(!) Queries Raised with Employee{list-option}
{list-option:Authorised}(/) Authorised{list-option}
{list-option:Denied}(!) Denied{list-option}
{list-data} || Notes | {text-data:ManagerNotes|type=area|width=340px} ||
{scaffold}
-
Inappropriate?Ah, ok. The {scaffold} macro is actually optional - it is only included for backwards-compatibility with Scaffolding 1.x. But since it's there, you can simplify your report by just adding "data:expense > " in front of your {report-info} keys. For example, your 'Manager Authorised' column above would be better written like so:
{report-column:title=Manager Authorised}{report-info:data:expense > data:ManagerAuthorised|render=wiki}{report-column}
Hope that helps.
Loading Profile...


EMPLOYEE

