Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Convert width of master page dynamically
mhw
<div>Hello,</div>
<div> </div>
<div>I want to change the width of the master page dynamically.</div>
<div>I am using a cross tab to display hours per day. I am using parameters to filter the number of days i.e. start date and end date.</div>
<div>Now i need to dynamically change the width of the master page like if it is displaying data for entire month then the width should be 16 in.And if it is displaying data for a week then 10 in.</div>
<div> </div>
<div>Will be great full if you will be able to help me.</div>
<div> </div>
<div>Thanks,</div>
<div> </div>
<div>Regards,</div>
<div>Mihir</div>
Find more posts tagged with
Comments
JFreeman
<p>You can add some scripting to dynamically adjust the master page in beforeFactory.</p>
<p>For Example:</p>
<pre class="_prettyXprint _lang-js">
reportContext.getReportRunnable().designHandle.getDesignHandle().findMasterPage("Simple MasterPage").setProperty("width", "16in");
</pre>
mhw
<p>Hello,</p>
<p>I tried using this script but it did not work.</p>
<p>I need a script that can change the width of the page depending on the value of the parameter passed,</p>
<p>ex suppose I view data for 30 days then the width of the page should be 16in.</p>
<p>and if i view the data for 15 days then the width of the page should be 10 in</p>
<p>this will depend on the value of the parameter startdate and enddate passed.</p>
<p>so width of the page should be determined after the parameter value are passed.</p>
<p> </p>
<p>I am using birt 3.7.1.</p>
<p>eclipse Indigo</p>
<p> </p>
<p>Thanks,</p>
<p>Regards,</p>
<p>mhw </p>
mhw
<p>I know this can be done in actuate but not sure how to do this in eclipse version of birt.</p>
<p>Is there a way i can do this by changing the XML of the report??</p>
<p>Thanks,</p>
<p>Mhw</p>
JFreeman
<p>There is no need to manually edit the XML of the report.</p>
<p> </p>
<p>You can do this in the beforeFactory of the report by performing a diff on the two date parameters and modifying the master page width accordingly. For Example:</p>
<pre class="_prettyXprint _lang-js">
if(BirtDateTime.diffDay(params["StartDate"].value, params["EndDate"].value) < 30){
reportContext.getReportRunnable().designHandle.getDesignHandle().findMasterPage("Simple MasterPage").setProperty("width", "10in");
}else{
reportContext.getReportRunnable().designHandle.getDesignHandle().findMasterPage("Simple MasterPage").setProperty("width", "16in");
}
</pre>
<p>Take a look at the attached sample report where I have implemented this code.</p>
<p> </p>
<p>Keep in mind you have to set the master page type to custom otherwise it will not accept the call to change the master page width.</p>
mhw
<p>thanks a lot the script worked pretty well...</p>
<p> </p>
<p>Mhw </p>
JFreeman
<p>You're welcome.</p>
<p>Let us know if you have additional questions.</p>
mhw
<p>sure Freeman</p>
<p> </p>
<p>regards,</p>
<p>mhw</p>
mhw
<p style="margin:0in;">hello,</p>
<p style="margin:0in;"><span style="font-size:11.5pt;font-family:Arial, sans-serif;">What I am trying to do now is,</span></p><p></p>
<p style="margin:0in 0in .0001pt;"><span style="font-size:11.5pt;font-family:Arial, sans-serif;">Instead of setting the page width according to the difference of start date and end date date,</span></p><p></p>
<p style="margin:0in 0in .0001pt;"><span style="font-size:11.5pt;font-family:Arial, sans-serif;">I want the width of the page to dynamically change according to the number of columns in the cross tab.</span></p><p></p>
<p style="margin:0in 0in .0001pt;"><span style="font-size:11.5pt;font-family:Arial, sans-serif;"> </span></p>
<p style="margin:0in 0in .0001pt;"><span style="font-size:11.5pt;font-family:Arial, sans-serif;">Because in some cases it is possible that the difference of start date and end date differ from the number of columns appearing in the cross tab.</span></p>
<p style="margin:0in 0in .0001pt;"><span style="font-size:11.5pt;font-family:Arial, sans-serif;"></span></p><p></p>
<p style="margin:0in 0in .0001pt;"> </p>
<p style="margin:0in 0in .0001pt;"><span style="font-size:15.3333330154419px;">Thanks,</span></p>
<p style="margin:0in 0in .0001pt;"> </p>
<p style="margin:0in 0in .0001pt;"><span style="font-size:15.3333330154419px;">Mhw</span></p>
JFreeman
<p>I will reply to you on your new thread about getting the number of columns: <a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/topic/36741-knowing-number-of-columns-appearing-in-a-cross-tab-dynamically/'>http://developer.actuate.com/community/forum/index.php?/topic/36741-knowing-number-of-columns-appearing-in-a-cross-tab-dynamically/</a></p>
;
<p> </p>
<p>This thread was about changing the master page width and the new question isn't about that specifically but about your logic for when to use the code to change the master page width and I would like to keep it dedicated to the original topic for future use.</p>