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)
custom footer on a different page
newbie321
<p>Hi, </p>
<p> </p>
<p>I have a report that I need to have a custom footer (from master-page) for. The data in the footer is dependent on the contents of the page for which the entry is created. Scenario: a table group caption goes into the footer. As the table group caption changes, the footer caption changes as well. </p>
<p> </p>
<p>I was thinking on using onPageEnd() event but then how do we capture current page's group caption?</p>
<p> </p>
<p>Anyone has any pointers on how to solve this task?</p>
<p> </p>
<p>Thanks! </p>
<p> </p>
<p> </p>
Find more posts tagged with
Comments
Clement Wong
<p>The attached sample requires that run and render task are separated. The footer text will be updated based on the country.</p>
<p> </p>
<p>In the <em>onCreate </em>event (of the header row and can be on detail row ), the value of the country is saved in a variable.</p>
<p> </p>
<p>The <em>onPageBreak </em>event of the table stores this value in a PersistentGlobalVariable, and the name of the PGV is an incremented variable name based on the current page number.</p>
<p> </p>
<p>In the <em>onRender </em>of the Text Item on the Footer of the Master Page, we retrieve the value of the PGV based on the page it's on, and then the text is updated based on the country.</p>
<p> </p>
newbie321
<p>Thanks for the pointers. Just to make sure I understand... Does PDF process does RunAndRender by default and the birt viewer runs Run and Render separately? </p>
<p> </p>
<p>Thanks,</p>
Clement Wong
<p>With the BIRT Viewer (<a data-ipb='nomediaparse' href='
http://www.eclipse.org/birt/documentation/integrating/viewer-usage.php'>http://www.eclipse.org/birt/documentation/integrating/viewer-usage.php</a>)
if you /preview, then you are doing a RunAndRender.</p>
<p> </p>
<p>If you /frameset, then you are doing a separate Run and then Render.</p>
<p> </p>
<p>I'm not sure about your use case, but if you can pass in &__format=pdf (instead of &__format=html) as URL paramter for /frameset, you will see the expected results in PDF.</p>
newbie321
<p>I am tapping into birt api directly through java to make the reports. The only time when I use viewer is when I need to preview something quick or test something. As far as changing 'html' to 'pdf' I am using RenderOptions and setting those there. </p>
<p>Currently I am running and then rendering, but will no visible desired effect. </p>
Clement Wong
<p>What's your Java code look like? So you using separate tasks, IRunTask and then IRenderTask (like <a data-ipb='nomediaparse' href='
https://wiki.eclipse.org/Separate_Run_and_Render_(BIRT)_2.1'>this</a>)
, or just IRunAndRenderTask?</p>
<p> </p>
<p>What version of BIRT are you using?</p>
jfranken
<p>If you can't get the dynamic footer functionality using the Master Page to work due to the run and render issue, the attached report illustrates a potential workaround that uses a group footer instead of the page footer. The main drawback to this method is that text will appear at the end of the data, but not necessarily at the very bottom of the page. </p>
<p> </p>
<p>Steps</p>
<p>Create a computed column in the data set of type running count.</p>
<p>Create a table group based on that column. Set the group interval to 1 less than the Page Break interval for the table.</p>
<p>Turn off the visibility of the computed column.</p>
<p>Add your dynamic data to the group footer. For this example I copied the customer name from the last row of the page into the footer, but you can customize it to your needs.</p>
<p> </p>
<p>Hopefully you can work with Clement to get the Master Page footer to work. If not, maybe this will help.</p>
<p> </p>
<p>Jeff</p>
newbie321
<blockquote class="ipsBlockquote" data-author="Clement Wong" data-cid="142050" data-time="1454378586">
<div>
<p>What's your Java code look like? So you using separate tasks, IRunTask and then IRenderTask (like <a data-ipb='nomediaparse' href='
https://wiki.eclipse.org/Separate_Run_and_Render_(BIRT)_2.1'>this</a>)
, or just IRunAndRenderTask?</p>
<p> </p>
<p>What version of BIRT are you using?</p>
</div>
</blockquote>
<p> </p>
<p>I am using Birt 4.5.0 (the latest release). I am using IRunTask and then IRenderTask similar to what is in the link you provided, except i am using PDFRenderOption when pushing .rptdocument into .pdf </p>
<p> </p>
<p>Incidentally, does this bug have anything to do with what we are talking about here? </p>
<p><a data-ipb='nomediaparse' href='
https://bugs.eclipse.org/bugs/show_bug.cgi?id=481003'>https://bugs.eclipse.org/bugs/show_bug.cgi?id=481003</a></p>
;
<p> </p>
<p>Thanks,</p>
Clement Wong
<p>I do not believe that Bugzilla link is related. To confirm, I ran two tests with the latest BIRT 4.5.0 Runtime, and I see what I should be expecting with my sample design from the previous post. Attached are the PDF results.</p>
<p> </p>
<p>On page 3, the footer shows USA which is correct for the Run and then Render PDF output. The Run and Render output shows non-USA which is expected.</p>
<p> </p>
<p>If you use your code with my sample report design, what do you see? </p>
<p> </p>
<p>For reference, the heart of my code is:</p>
<pre class="_prettyXprint">
// Open the report design
IReportRunnable DESIGN = engine.openReportDesign("C:/temp/pdf.rptdesign");
//// Run andRender
//IRunAndRenderTask TASK = engine.createRunAndRenderTask(DESIGN);
//Create task to run the report - use the task to execute and run the report,
IRunTask TASK = engine.createRunTask(DESIGN);
//Create rptdocument
TASK.run("C:/temp/pdf.rptdocument");
//Open rptdocument
IReportDocument RPTDOC = engine.openReportDocument("C:/temp/pdf.rptdocument");
//Create Render Task
IRenderTask RTASK = engine.createRenderTask(RPTDOC);
PDFRenderOption PDF_OPTIONS = new PDFRenderOption();
PDF_OPTIONS.setOutputFileName("C:/temp/pdf-RunTHENRender.pdf");
PDF_OPTIONS.setOutputFormat("pdf");
RTASK.setRenderOption(PDF_OPTIONS);
RTASK.render();
</pre>
newbie321
<blockquote class="ipsBlockquote" data-author="Clement Wong" data-cid="142066" data-time="1454446197">
<div>
<p> </p>
<p>I do not believe that Bugzilla link is related. To confirm, I ran two tests with the latest BIRT 4.5.0 Runtime, and I see what I should be expecting with my sample design from the previous post. Attached are the PDF results.</p>
<p> </p>
<p>On page 3, the footer shows USA which is correct for the Run and then Render PDF output. The Run and Render output shows non-USA which is expected.</p>
<p> </p>
<p>If you use your code with my sample report design, what do you see? </p>
<p> </p>
<p>For reference, the heart of my code is:</p>
<pre class="_prettyXprint">
// Open the report design
IReportRunnable DESIGN = engine.openReportDesign("C:/temp/pdf.rptdesign");
//// Run andRender
//IRunAndRenderTask TASK = engine.createRunAndRenderTask(DESIGN);
//Create task to run the report - use the task to execute and run the report,
IRunTask TASK = engine.createRunTask(DESIGN);
//Create rptdocument
TASK.run("C:/temp/pdf.rptdocument");
//Open rptdocument
IReportDocument RPTDOC = engine.openReportDocument("C:/Users/cwong/workspaceBIRT421/REAPIHelloWorld/src/pdf.rptdocument");
//Create Render Task
IRenderTask RTASK = engine.createRenderTask(RPTDOC);
PDFRenderOption PDF_OPTIONS = new PDFRenderOption();
PDF_OPTIONS.setOutputFileName("C:/temp/pdf-RunTHENRender.pdf");
PDF_OPTIONS.setOutputFormat("pdf");
RTASK.setRenderOption(PDF_OPTIONS);
RTASK.render();
</pre>
</div>
</blockquote>
<p> </p>
<p>Thanks, Clement!! </p>
<p> </p>
<p>I redid everything again and it worked. Much appreciated!! </p>
newbie321
<blockquote class="ipsBlockquote" data-author="jfranken" data-cid="142057" data-time="1454425061">
<div>
<p>If you can't get the dynamic footer functionality using the Master Page to work due to the run and render issue, the attached report illustrates a potential workaround that uses a group footer instead of the page footer. The main drawback to this method is that text will appear at the end of the data, but not necessarily at the very bottom of the page. </p>
<p> </p>
<p>Steps</p>
<p>Create a computed column in the data set of type running count.</p>
<p>Create a table group based on that column. Set the group interval to 1 less than the Page Break interval for the table.</p>
<p>Turn off the visibility of the computed column.</p>
<p>Add your dynamic data to the group footer. For this example I copied the customer name from the last row of the page into the footer, but you can customize it to your needs.</p>
<p> </p>
<p>Hopefully you can work with Clement to get the Master Page footer to work. If not, maybe this will help.</p>
<p> </p>
<p>Jeff</p>
</div>
</blockquote>
<p> </p>
<p>Thanks Jeff! </p>
<p>Very nice work-around!! </p>