Using macro-body for parameters to reporting-filters
I need to build a report that will be included in a page template where the report content must vary for each page built from the template, so to achieve this the report uses a text-filter include with the page title as reg-exp.
The users of this functionality will themselves create new pages from the template, but being non-technical they are not interested in entering the page title into the text-filter themselves. Therefore I need a way to automatically add the current page title into the text-filter tag dynamically. I've tried using injection (%page:title%), but that does not seem to work.
Would it be possible to provide filter parameters in the macro-body like this:
{text-filter:data:Fields|body=include}*.{report-info:page:title}*.{text-filter}
As you can see I've put a stand-alone report-info into the filter body, and added a parameter called "body" that lets you specify if the body content should be considered in pace of the "include" or "exclude" parameters.
Would it even be possible to put a stand-alone report-info like this inside a reporter?
The users of this functionality will themselves create new pages from the template, but being non-technical they are not interested in entering the page title into the text-filter themselves. Therefore I need a way to automatically add the current page title into the text-filter tag dynamically. I've tried using injection (%page:title%), but that does not seem to work.
Would it be possible to provide filter parameters in the macro-body like this:
{text-filter:data:Fields|body=include}*.{report-info:page:title}*.{text-filter}
As you can see I've put a stand-alone report-info into the filter body, and added a parameter called "body" that lets you specify if the body content should be considered in pace of the "include" or "exclude" parameters.
Would it even be possible to put a stand-alone report-info like this inside a reporter?
1
person has 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?Well, currently it doesn't do that obviously. It might be possible for some of the filters to have something along those lines. However, there is a way to achieve what you're after at the moment by wrapping the whole report inside a {report-on:injected=true}, which will allow injection to work as you expect. Eg:
{report-on:injected=true}
{report-block}
{local-reporter:content:children}
{text-filter:data:Fields|include=.*%page:title%.*}
{local-reporter}
{report-body}{report-info:page:title|link=true}{repot-body}
{report-block}
{report-on}
Substitute your own report, of course...
1 person says
this answers the question
-
Inappropriate?Thanks a lot, that seems to work as expected, however my case is of course slightly more advanced than what I asked for :-)
I'm using the report in question to generate a set of list-options for a list-data scaffold surrounding the report. To get the list-option macro to render its body I've found that the data has to be injected instead of using report-info, meaning that with your suggestion there is a double injection happening.
When I applied your suggestion the dynamic text filter works like I wanted in a test case, but with my actual code i'm now getting "Error formatting macro: report-on: java.lang.NoClassDefFoundError: com/atlassian/confluence/mail/address/ConfluenceMailAddress" in place of the expected list. Changing the second injection to a report-info macro makes the list work, but every item is the unrendered report-info macro instead of the expected results.
My code looks like this when giving the abovementioned error:
{list-data:Oppgave|blank=true}
{report-on:injected=true}
{report-block:injected=true}
{expanding-reporter:data:Oppgaver|as=oppgave}
{local-reporter:page:descendents|source=Milepæler}
{text-filter:page:labels|include=.*arbeidspakke.*}
{local-reporter}
{expanding-reporter}
{text-filter:oppgave > data:Personer|include=.*%page:title%.*}
{report-body}{list-option}%oppgave > data:Oppgave%{list-option}{report-body}
{report-empty}Ingen oppgaver.{report-empty}
{report-block}
{report-on}
{list-data}
Any tips on how I can force rendering of the report-info macro so that each list-option contains the report item result?
I’m confident
-
Inappropriate?I'm guessing that you're using Confluence 2.10.x with Reporting 3.2.0? That would be one of the incompatibilites introduce in that version with Confluence 2.10.x. Atlassian changed the class that email addresses are returned as in 3.0, so we had to change Reporting to match. As a result, it's no longer completely compatible with 2.10.x. The short answer is, you will probably have to upgrade to 3.0.x.
-
Inappropriate?Actually I'm using Confluence 2.9 with Reporting 3.1.0 (at least I think I managed to downgrade back to 3.1.0 as some compatibility-issues I had after upgrading has disappeared, but it still reports 3.2.0 in the plugin-console).
The downgrade probably wasn't completely successful so maybe that is causing the issue. Should the report above be working as expected with Reporting 3.1.0 on Confluence 2.9? In that case I'll give downgrading another shot.
I'd love to upgrade but I'll have to get this working on the current system as it is needed in just a few days. An upgrade for Confluence is coming, but it'll be a while before it gets done. Big organization and all that...
Thanks a lot for your help!
I’m thankful
-
I've now ensured that I've downgraded to Reporting 3.1.0, but this somehow caused the report-on fix to stop working, also on simpler test cases without the list-data and list-options present. Very strange. -
Inappropriate?Hmm. Not sure what would be causing this. Have you restarted Confluence since the downgrade? Sometimes there are lingering classes around that cause clashes. Also, check your log files, particularly 'catalina.out' and 'atlassian-confluence.log'.
-
Yes I have restarted, so that should not be a problem. It could of course be that this code thats pretty complex in itself also is contained inside a table-data structure, so theres a bunch of possiblities for conflicts... -
Inappropriate?I couldn't figure out why your {report-on} trick stopped working, but I found another comment you made somewhere else about using a custom user macro instead, and since all I needed to filter on was the page title that worked for me. It'll do until we get Confluence 3 up and running :-)
Thank you very much for all your help. For great customer service you guys are simply unbeatable :-)
I’m thankful
-
If you like, either post your full markup here, or if you would prefer, email it to me and I'll see if there's anything obvious that can be fixed... -
Thank you for the offer, but I'm a bit short on time with this right now, so I'll just leave it working like it currently is until we can upgrade to 3.0, and only then do all of the simplifications allowed for by the new features.
Thanks anyway! -
Inappropriate?Hi again!
We've finally upgraded to Confluence 3.0.2, and I've upgraded to Reporting 3.2.0 as well, but your neat trick of enclosing a report inside an {report-on:injected=true} macro to get injections from the current page, which is something I've started using several places, now suddenly gives the following error:
Error formatting macro: report-on: java.lang.StackOverflowError
I've tested the report-on seperatly and it works as expected, but it gives the error when enclosing another report like this:
{text-data:Label}{text-data}
{report-on:injected=true}
{report-table}
{space-reporter:space=@global}
{text-filter:space:labels|include=.*%data:Label%.*}
{space-reporter}
{report-column:title=Prosjekt} {report-info:space:name|link=true} {report-column}
{report-empty}Empty.{report-empty}
{report-table}
{report-on}
Any ideas?
I’m puzzled
-
Inappropriate?Hi there,
We've come across the StackOverflowError in a couple of places, and it's hopefully been resolved in the latest version. However, that will require updating to Confluence 3.1 I believe. Either way, test it on a non-production server if you can and see how you go.
David -
Thanks! I'll try that. -
This comment was removed on 02/01/10.
see the change log
Loading Profile...



EMPLOYEE