Count elements from page great-children
Hi,
I already did this post on your Reporting Plugin page but I cannot see it anymore.
Here, it should be the best place to post it again :)
I try to count the number of comments for all page children.
I give you my pagetree:
Page Project
|__Page Need 1
| |__Page Requirement 1
| |__Page Requirement 2
| | |_Comment 1
| | | |_Comment 2
| | |_Comment 3
| |__Page Requirement 3
| | |_Comment 4
|
|__Page Need 2
| |__Page Requirement 4
| |__Page Requirement 5
| | |_Comment 5
So on so forth.
So on the page Project I'm trying to count the total number of Comments per Need and the last comment for each Need. I try to di it with the Reporting Plugin
I use this code:
{report-table}
{content-reporter:scope=@self > children|type=page}
{text-sort:content:title}
{content-reporter}
{report-column:title=Needs} {report-info:content:title|link=true} \\{report-info:content:excerpt}{report-column}
{report-column:title=Owner}{report-info:data:Ownersource}{report-column}
{report-column:title=Nb Requirements}{report-info:content:children > size}{report-column}
{report-column:title=Nb Comments}
{report-info:content:children > all comments > size}
{report-column}
{report-column:title=Last Comment}
{report-info:content: children > all comments > last > creation date|format=dd MMM yyyy HH:mm} {report-info:content:children > all comments > last > creator > user:full name|link=true}
{report-column}
{report-table}
The two columns "Nb Comments" and "Last Comment" don't work
I quite sure that "children > all comments" is the key part, I should do a loop to sum all comments done for each child, but I don't know how to do it.
Thanks for your returns and help
Cyrille
I already did this post on your Reporting Plugin page but I cannot see it anymore.
Here, it should be the best place to post it again :)
I try to count the number of comments for all page children.
I give you my pagetree:
Page Project
|__Page Need 1
| |__Page Requirement 1
| |__Page Requirement 2
| | |_Comment 1
| | | |_Comment 2
| | |_Comment 3
| |__Page Requirement 3
| | |_Comment 4
|
|__Page Need 2
| |__Page Requirement 4
| |__Page Requirement 5
| | |_Comment 5
So on so forth.
So on the page Project I'm trying to count the total number of Comments per Need and the last comment for each Need. I try to di it with the Reporting Plugin
I use this code:
{report-table}
{content-reporter:scope=@self > children|type=page}
{text-sort:content:title}
{content-reporter}
{report-column:title=Needs} {report-info:content:title|link=true} \\{report-info:content:excerpt}{report-column}
{report-column:title=Owner}{report-info:data:Ownersource}{report-column}
{report-column:title=Nb Requirements}{report-info:content:children > size}{report-column}
{report-column:title=Nb Comments}
{report-info:content:children > all comments > size}
{report-column}
{report-column:title=Last Comment}
{report-info:content: children > all comments > last > creation date|format=dd MMM yyyy HH:mm} {report-info:content:children > all comments > last > creator > user:full name|link=true}
{report-column}
{report-table}
The two columns "Nb Comments" and "Last Comment" don't work
I quite sure that "children > all comments" is the key part, I should do a loop to sum all comments done for each child, but I don't know how to do it.
Thanks for your returns and help
Cyrille
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 company marked this question as answered.
-
Inappropriate?Sorry for 'disappearing' your original question. We're transitioning to this site for support, and a few questions have probably gotten missed along the way.
What you really want here is a new feature that will be in the next version. As you said, the key issue is the 'children > all comments', which is a many X many relationship. In fact pretty much the exact example you give is in the JIRA issue for the feature: REPOR-226
The main difference is that you want the 'sum', not the 'average', so your example would be:
{report-info:page:children > stats-on: "page:all comments > collection:size" > stats:sum}
My suggestion would be to view the REPOR-226 issue and add yourself as a watcher so you will be notified once the plugin is released.
For the 'Last Post' example, I would use an inner-report to pull out the result you're after. Something like:
{report-block:maxResults=1}
{expanding-reporter:all comments|as=comment}
{local-reporter:content:children}
{date-sort:creation date|order=descending}
{expanding-reporter}
{report-body}
{report-info:expanded:comment > creation date|format=dd MMM yyyy HH:mm} - {report-info:expanded:comment > creator > user:full name|link=true}
{report-body}
{report-block}
However, this will probably be slow if you have a lot of children + sub-comments...
Also, as a performance tip swap out our {content-reporter} report at the beginning with a {local-reporter}, like so:
{local-reporter:children}
{text-sort:content:title}
{local-reporter}
It will be way faster once your space starts expanding.
I’m glad I got 1 out of 2.
-
Thank you David, the second part works very well.
For the first one I will wait for the version 3.2.0 :)
Thank you again for your time and your answer -
Inappropriate?I was to quick on my first reply :)
In fact when I try the second part, I was in the situation where my last comment was on my last created requirement.
But if it is my first requirement which holds the last comment, I will always see the last comment of the last requirement and not the lastest one.
I’m sure we are not so far
-
Make sure the {date-sort} is outside the internal {local-reporter}. If you've added any filters, etc, it has to go outside the closing {local-reporter} tag. -
Inappropriate?Ya, I put the {date-sort} outside the closing {local-reporter}
-
In fact the {date-sort} is well applied on the comments for each Requirement, but requirements are first sorted on their creation date (default sort, I'm assuming).
So Comments for each Requirement are well sorted, but the full list of comments is not. -
If the filter is in the {expanded-reporter} not the {local-reporter} it should be sorting across all the results. I think. If it's not, it's a bug. Want to create a bug report for me? -
Of course :o)
Loading Profile...



EMPLOYEE