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)
Using rptdocument to generate some reports problems.
xpaterna
Hi!
I'm generating reports with the Report Engine API 3.7.2 and I have the nexts problems:
My idea is generating a rptdocument with the Run task and then generate 1 html and 2 pdf reports with the Render task using that rptdocument.
I have 2 themes in a rptlibrary, one for the html and the other one for pdf.
The first problem (or the first question) is: can I change the report theme in beforeRender script of the report? I tried it but I get some errors because it cannot find the library, so, I have to re-Run the report (and generate another rptdocument) only for change the theme?
The second problem is similar. I have a table in the report, and in the first column I have images. In one of the pdf reports I want to display this column and in the other one I want to hide.
I tried to put a report parameter and use it in the "Visibility" tab of the first column, but I think in the RenderTask the report can't access to the report parameters, am I wrong with this? I have to re-Run the report only for change the visibility of one column?
Thank you very much for your time, and I'm sorry for my english.
Find more posts tagged with
Comments
johnw
Its easier to do it in the initialize or beforeFactory, then use reportContext.getOutputFormat() to get the output format, then change the design to whatever theme.
So a initialize script would look something like:
if (reportContext.getOutputFormat() == "PDF")
{
reportContext.getDesignHandle().setThemeName("PDf_THEME");
}
else
{
reportContext.getDesignHandle().setThemeName("HTML_THEME");
}
xpaterna
<blockquote class='ipsBlockquote' data-author="'johnw'" data-cid="111907" data-time="1354125755" data-date="28 November 2012 - 11:02 AM"><p>
Its easier to do it in the initialize or beforeFactory, then use reportContext.getOutputFormat() to get the output format, then change the design to whatever theme. <br />
<br />
So a initialize script would look something like:<br />
if (reportContext.getOutputFormat() == "PDF")<br />
{<br />
reportContext.getDesignHandle().setThemeName("PDf_THEME");<br />
}<br />
else<br />
{<br />
reportContext.getDesignHandle().setThemeName("HTML_THEME");<br />
}<br /></p></blockquote>
<br />
Hi johnw, <br />
<br />
Thanks for the response. <br />
I tried your solution and works when I use the runandrendertask but what I would achieve is to generate a single rptdocument and then render it in different outputs. So the only event I can use is the "beforeRender", and I think render task can't access to the rptlibrary. <br />
Is there any way to achieve what I want? <br />
<br />
The database queries are so large and slow and I don't want to repeat the same queries only for change the theme or for change the visibility of a column. <br />
If you know what can I do please tell me. <br />
Thanks again for your time!<br />
<br />
EDIT:<br />
When I try to run the RenderTask with your part of code, report engine throws an exception:<br />
<br />
Wrapped org.eclipse.birt.report.model.api.command.ThemeException: The theme "UI.WebTheme" used by Report Design is not found.<br />
<br />
How can I change the theme in the Render task? I have already the rptdocument generated, so the only I want is generate two reports (one in HTML and the other one in PDF) with two different themes.<br />
<br />
Thank you!