Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Multiple Master Pages
KSTENNER
In a report that has multiple master pages, is there a way to choose which master page is used based on the value of a data element?
If the data element = 'X', then I want to use Master Page 1 and if the data element <> 'X', then I want to use master page 2.
Any suggestions would be greatly appreciated.
Find more posts tagged with
Comments
mwilliams
Hi KSTENNER,
Are you talking a data element within a table? Or do you just have a data element in the report design, not within a table?
KSTENNER
It is within a table.
mwilliams
KSTENNER,
Currently, you cannot change the master page within a given element. So, the table will have the same master page the entire time. I believe in 2.6.0, there is supposed to be the ability to have the master page switch within a single element. I have not tested this out and don't know if this new feature would work for what you're wanting. You could try downloading the latest stable build of 2.6 from eclipse.org/birt and see if it is able to do what you're wanting.
KSTENNER
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="65603" data-time="1276661900" data-date="15 June 2010 - 09:18 PM"><p>
KSTENNER,<br />
<br />
Currently, you cannot change the master page within a given element. So, the table will have the same master page the entire time. I believe in 2.6.0, there is supposed to be the ability to have the master page switch within a single element. I have not tested this out and don't know if this new feature would work for what you're wanting. You could try downloading the latest stable build of 2.6 from eclipse.org/birt and see if it is able to do what you're wanting.<br /></p></blockquote>
mwilliams
KSTENNER,
Not sure if you meant to post something in your last post besides quoting me and it got deleted or something, so I just thought I'd check. Let me know.
KSTENNER
Micheal,
Yes, I had a computer malfunction when I went to post. My reply was supposed to be...
I do want the master page applied to the entire page, but I want to choose the master page based on a data element within the table. I have column visibilites based on the same data element. What I'm looking for is that if the data element = 'x' then I want legal sized paper and if the data element <> 'x' then I want letter size paper.
I am currently using BIRT 2.5.0
Thanks,
kstenner
mwilliams
Hi kstenner,
So, your master page you select would be for the entire report? Not changing on a value by value basis? Does this value you're checking come directly from your dataSet?
KSTENNER
Michael,
Yes, the master page would be set for the entire report. Yes, the data element is in the data set as well as the table.
Thanks,
kstenner
mwilliams
kstenner,
If you grab the value in your onFetch of your dataSet, then in your onCreate of your table (or whatever the first element in your report is), you can check this variable that you stored the value in and set the master page with the following script:
this.getStyle().masterPage = "masterPageName"
Hope this helps.
KSTENNER
Michael,
I think I almost have this working, but not quite.
In the onFetch of the dataSet, I have the following:
reportContext.setPersistentGlobalVariable("Page", 'row["BUDGET_MULTIPLIER"]');
In the onCreate of the first table, I have:
var Table_Page = reportContext.getPersistentGlobalVariable('Page');
if ( Table_Page == 5 )
{ this.getStyle().masterPage="Legal_Page"; }
else { this.getStyle().masterPage="Letter_Page"; }
This works if I put a static variable in place of 'row["BUDGET_MULTIPLIER"]', but it is not working with the dynamic value. Any thoughts?
Thanks,
kstenner
mwilliams
kstenner,
A PGV must be stored as a string, so if your "budget_multiplier" field is an integer, you might try using the .toString() function when setting the PGV. Also, in your check, you might change it to check the string "5" rather than just 5. Or parse the variable string to an integer again. Those could be a couple possibilities.
Let me know.
KSTENNER
Michael,
Converting it to a string worked. Thanks for your help!
kstenner
mwilliams
Not a problem. Let us know whenever you have questions!