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)
Deploying BIRT report in Grails application
Ramcis
Hi All,
I'm using BIRT as reporting engine for a grails application using the plugin. I have created a report that takes one parameter to filter the data in a sql query. However, I couldn't figure out how to set the parameter from the controller. I tried using the same parameter name in the controller and the report but it doesn't work.
Any insights on how to make it work
Cheers,
Ramzi
Find more posts tagged with
Comments
mwilliams
From a quick look, it appears you just pass the parameter through the runAndRender or the run function. I don't know if this is a comma separated list or a hash or what, though. What have you tried?
Ramcis
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="111353" data-time="1352390876" data-date="08 November 2012 - 09:07 AM"><p>
From a quick look, it appears you just pass the parameter through the runAndRender or the run function. I don't know if this is a comma separated list or a hash or what, though. What have you tried?<br /></p></blockquote>
<br />
It got it working, thankk you !
mwilliams
Great! Glad you got it! What did you need to pass the parameters as, in the function?
Ramcis
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="111450" data-time="1352760802" data-date="12 November 2012 - 03:53 PM"><p>
Great! Glad you got it! What did you need to pass the parameters as, in the function?<br /></p></blockquote>
<br />
Well, basically my report wasn't able to get the parameter because I was using the wrong datasource at first. So when I changed it, my report was screwed up somehow. So, I ended up deleting all the datasources and dataset mapping and started from scratch which worked like a charm. <br />
<br />
BTW, is possible to set dynamicaly the size of the output so that the report engine will strech the data to make the report fit in the specified size or I have to create multiple templates (I have sections in the report that may be excluded from rendering, thus I want to resize it). <br />
<br />
Thank you very much !!!<br />
Ramzi
mwilliams
Not sure if I'm understanding 100%. Can you explain your new question a little more in detail? Thanks!
Ramcis
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="111476" data-time="1352820965" data-date="13 November 2012 - 08:36 AM"><p>
Not sure if I'm understanding 100%. Can you explain your new question a little more in detail? Thanks!<br /></p></blockquote>
<br />
Let say I have a report with 3 sections that the user can exclude or include from/in the report. The user choosed only to export 2 sections, how can I change the size of the report to avoid having a big blank area. The intuitive solution is to create a template for every possible combination and then based on the configuration I figure out which template to use.<br />
<br />
Thanks!
mwilliams
If the user chooses these sections by parameter, you can easily drop the unneeded section from the template in the beforeFactory of the report. This will allow you to have a single template for all situations. You just have to write the script to handle the parameter selections. This will also handle any spacing issues, since the section will actually be dropped from the design, rather than just hidden.
Ramcis
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="111481" data-time="1352836439" data-date="13 November 2012 - 12:53 PM"><p>
If the user chooses these sections by parameter, you can easily drop the unneeded section from the template in the beforeFactory of the report. This will allow you to have a single template for all situations. You just have to write the script to handle the parameter selections. This will also handle any spacing issues, since the section will actually be dropped from the design, rather than just hidden.<br /></p></blockquote>
<br />
Thank you for all these clarifications. I do understand how it works, but it would be great if you could point me out some documentation about (I just started doing report with birt few days ago)<br />
<br />
Thanks,<br />
Ramzi
mwilliams
Sorry for the delay, I was out of town. What is your BIRT version? I'll just make you a simple example.
Ramcis
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="111616" data-time="1353168130" data-date="17 November 2012 - 09:02 AM"><p>
Sorry for the delay, I was out of town. What is your BIRT version? I'll just make you a simple example.<br /></p></blockquote>
<br />
<br />
it's 3.2.2 Thank you !
mwilliams
Again, sorry for the delay. Thanksgiving came at just the wrong time!
I'll get an example made up and attached, right now.
mwilliams
Well, I can't run that old of a version of Eclipse, with the Java 1.7, like I have, so I'll just have to tell you. If you have a parameter called "option", where the user chooses between option1 and option2 and you have two tables, one named table1 and one named table2, your beforeFactory script would look something like this:
if(params["option"] == "option1"){
reportContext.getDesignHandle().findElement("table2").drop();
}
else{
reportContext.getDesignHandle().findElement("table1").drop();
}
This would drop table 2 if option1 is chosen and table1 if option2 is chosen. Hope this helps.
Ramcis
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="111832" data-time="1353945690" data-date="26 November 2012 - 09:01 AM"><p>
Well, I can't run that old of a version of Eclipse, with the Java 1.7, like I have, so I'll just have to tell you. If you have a parameter called "option", where the user chooses between option1 and option2 and you have two tables, one named table1 and one named table2, your beforeFactory script would look something like this:<br />
<br />
if(params["option"] == "option1"){<br />
reportContext.getDesignHandle().findElement("table2").drop();<br />
}<br />
else{<br />
reportContext.getDesignHandle().findElement("table1").drop();<br />
}<br />
<br />
This would drop table 2 if option1 is chosen and table1 if option2 is chosen. Hope this helps.<br /></p></blockquote>
<br />
<br />
Thank you for the hint. <br />
BTW, I'm using the lastest STS version of Eclipse. 3.2.2 is my Birt version. <br />
<br />
Ramzi