cristic83 Posted March 2, 2011 Share Posted March 2, 2011 Hi guys,I want to generate a report whose header is different depending on the data that's inside the report: e.g if I show data for a month then the header should be "Monthly report" and if the data is for a week the header should be "Weekly report". Of course, the header should be internationlized.I tried to solve this by using a parameter named reportType that's passed to the report template and then in the report template do something like this for the report header:$R{$P{reportType}+".report.title"}This doesn't work; when I try to compile this(in iReport) I get the following error: Syntax on token "$R", Assignment Operator expected after this token. Is there a way how I can achieve this?As a workaround, I could use the $P{reportType} parameter to contain the value of the resource bundle item that I nedd to display, but I don't want to do this because then if the resource bundle changes the references to it would have to be changed both in the report template and in the code.Thanks, Cristi Link to comment Share on other sites More sharing options...
szaharia Posted March 2, 2011 Share Posted March 2, 2011 Hi,Try this workaround: create 2 identical text fields in your header (ie with the same x, y, width, height, style, etc), but with different printWhenExpressions and textFieldExpressions.Depending on their printWhenExpression, one of these text fields will be printed out in monthly reports, the other one in the weekly reports.Hope this helps,sanda Code: Post Edited by shertage at 03/02/2011 13:45 Link to comment Share on other sites More sharing options...
marius_fc Posted April 11, 2011 Share Posted April 11, 2011 Hi,I have the same problem but I did something like this:1. parameter paramName = "resourceKey"2. text field expression = msg(str($P{paramName}),null)I hope this it helps. Link to comment Share on other sites More sharing options...
maartenvd84 Posted September 3, 2020 Share Posted September 3, 2020 The solution from Marius seemed to do the trick for me as well. Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now