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)
Conditional logic based on output format?
EricB
Hi All,
I'm looking to have some condition in BIRT script that only executes for certain output formats. Specifically, I want to limit the # of results returned if the output format is excel. Can anyone post sample code to determine the output format? Or if there's a better way to accomplish this, I'm open to suggestions.
Thanks!,
Eric
Find more posts tagged with
Comments
mwilliams
Try this:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
if (reportContext.getOutputFormat() == "XLS"){
//do this
}
</pre>
EricB
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="97832" data-time="1331836454" data-date="15 March 2012 - 11:34 AM"><p>
Try this:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
if (reportContext.getOutputFormat() == "XLS"){
//do this
}
</pre></p></blockquote>
Beautiful! Only difference is that the format turned out to be lower-case. To test it out, I added the following 'Is True' filter condition to my Data Set and it worked:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>if (reportContext.getOutputFormat() == "xls"){
row[0]<2;
}else{
true;
}</pre>
<br />
Thanks for the help!<br />
<br />
Eric
mwilliams
Oops! Sorry about that! I Just capitalized XLS out of habit! Let us know whenever you have questions!