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)
Change the Report Type based on the selected Emitter
shanuma
<p>I want to have the Report Type A4 by default and set it to "Custom" only if the emitter type is Excel.</p>
<p> </p>
<p>How can I achieve this?</p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p>/Uma</p>
Find more posts tagged with
Comments
Matthew L.
<p>You could do something like this in the beforeFactory method of the report design.</p>
<pre class="_prettyXprint _lang-js">
var masterPageName = reportContext.getDesignHandle().getMasterPages().get(0).getName(); //Get first Masterpage Name.
reportContext.getDesignHandle().findMasterPage(masterPageName).pageType="a4"; //Set masterpage type to A4
if( reportContext.getOutputFormat() == "xls" || reportContext.getOutputFormat() == "xlsx" ){ //If xls or xlsx
reportContext.getDesignHandle().findMasterPage(masterPageName).setProperty("height", "11in"); //Set page height
reportContext.getDesignHandle().findMasterPage(masterPageName).setProperty("width", "8.5in"); //Set page width
reportContext.getDesignHandle().findMasterPage(masterPageName).pageType="custom"; //Set type to custom
}
</pre>