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)
Crosstab in Fixed Layout Report
lotusman
<p>Hi All,</p><p> </p><p>Wondering if anyone else has encountered and dealt with this. I have been forced to convert my report to a fixed format report (to get a printable Table of Contents to work correctly), but I would like the crosstabs to continue to auto fit as required. I want the column widths to stay static, but to have the text fields wrap the text and expand the fields vertically as required by the text size. So far I have been unable to find a way to do this. Wondering if anyone might now how to do so via scripting or otherwise?</p><p> </p><p>I am using BIRT 3.7.2.</p><p> </p><p>Thanks</p><p> </p>
Find more posts tagged with
Comments
kclark
<p>If you select the crosstab > property editor > column area > page break > add. You can add a page break here and set the interval to whatever you'd like so the crosstab remains readable. Let me know if this is what you're looking for
</p>
lotusman
<p>Hi,</p><p> </p><p>Thanks for that, but I don't think that is what I need. Basically, I have a fixed layout on the report (only to get a printable Table of Contents to work correctly), but want some items to allocate space dynamically as required (charts, table/crosstab fields, etc) so that they fit and display their entire contents. </p><p> </p><p>Thanks</p><p> </p>
lotusman
<p>Ok, as a follow up to this, I have been trying to alter the report layout via scripting between the run and render phases. Looking at the Report Scripting lifecycle at <a data-ipb='nomediaparse' href='
http://www.eclipse.org/birt/phoenix/deploy/reportScripting.php'>http://www.eclipse.org/birt/phoenix/deploy/reportScripting.php</a> it
appears I should be able to alter the report layout in afterFactory or beforeRender. But so far I have been unable to get it to work. </p><p> </p><p>reportContext.getDesignHandle().setLayoutPreference(DesignChoiceConstants.REPORT_LAYOUT_PREFERENCE_FIXED_LAYOUT);</p><p> </p><p>I found the following at <a data-ipb='nomediaparse' href='
http://www.eclipse.org/birt/phoenix/deploy/reportEngineAPI.php'>http://www.eclipse.org/birt/phoenix/deploy/reportEngineAPI.php</a> in
the IReportDocument section. </p><p> </p><p><em>BIRT optionally can store reports in an intermediate format, after generation and before rendering. This document, with the default extension rptdocument, can be manipulated with the IReportDocument interface. The Engine will create this document when the runTask is used. The BIRT viewer uses this format to do pagination, TOCs, CSV extraction, bookmarks, etc. When finished with a IReportDocument, be sure to close it, with the close() method.</em></p><p> </p><p>I can't see any reason why I couldn't change the layout after the run phase (yes, I do realize it might be slightly different once converted to AUTO_LAYOUT from FIXED_LAYOUT), but I can't seem to get it to work....</p><p> </p><p>Anyone have any insights?</p><p>Thanks</p>
kclark
<p>Try doing this in the beforeRender()</p><pre class="_prettyXprint">reportContext.getDesignHandle().layoutPreference = "auto layout" // or “fixed layoutâ€</pre>
lotusman
<blockquote class="ipsBlockquote" data-author="kclark" data-cid="119893" data-time="1378237019"><div><p> </p><p>Try doing this in the beforeRender()</p><pre class="_prettyXprint">reportContext.getDesignHandle().layoutPreference = "auto layout" // or “fixed layoutâ€</pre></div></blockquote><p> </p><p>Thanks for the idea, but it doesn't appear to work any more than the other code listed above (sadly). As far as I can tell, updating the layout is ignored when set in script between run and render phases (in separate steps). Or at least I haven't found a way to do it yet.</p>
CBR
<p>kclarks solution works for me.</p><p> </p><p>If you are using the two phases model to generate the report you have to be aware of the fact that run and render are isolated from each other. Variables or properties (like layoutPreference) set through scripting in the run phase will no longer be visible in render events.</p><p>Therefore it is important that you put the code in beforeRender and not in afterFactory. If you set it in afterFactory it will not work.</p><p>Assuming that run and render are not isolated in the two phases model is the most common mistake because they are not isolated in the one phases model.</p><p> </p><p>Regarding your question:</p><p>I m not sure why you need to reset the layout preference from fixed to auto layout. I understood that auto layout is required to make the crosstab look nice, but i do not understand how it could solve a problem with the table of contents.</p><p>If fixed layout could solve the TOC problem it will eventually break if you reset the layout preference for the rendering.</p><p>Unfortunately one could not set the layout preference per report item. It is a global setting that will affect all report items within that report and there is no way around that.</p>
lotusman
<p>Interesting. I wonder why it's not working for me. Are you using BIRT 3.7.2? We are doing a 2 phase report generation. I put the code in the beforeRender event of the report, so I would assume it would be picked up when the render phase was started from our Java code, but it never seems to be. What layout preference did you start with in your report design? Fixed or Auto? How are you doing the 2 phase run and render? From Java? What run and render methods are you using to submit the report - maybe something you are doing differs from how we are doing it. </p><p> </p><p>As to the why - basically I was forced to use Fixed Layout to make the Table of Contents page numbers generate correctly in the run phase and allow it to be printed to one of the report pages in the render phase - otherwise the report was already displaying the way I preferred in Auto Layout. I would prefer auto layout as that resizes various items for the amount of text, image size, etc appropriately, which Fixed Layout does not. The tables seem to be fine and resize accordingly even in Fixed layout, but the crosstab does not resize, nor does an image used as a cell background even though in design the image displays completely (not sure why it gets cutoff in fixed mode). I had the idea to try changing the layout to see what happened between a fixed and auto layout to see if that would work, realizing that it may have some impacts. So far I have been unable to make it work. </p><p> </p><p> </p>
CBR
<p>Could you try to run the report attached?</p><p> </p><p>It has a label aligned to the right. The report itself is Fixed Layout but i set it to auto layout in beforeRender.</p><p>I tried both WebViewer and custom Java. Both show the label at the right corner of the browser window (auto layout) on my PC.</p>
lotusman
<p>Sorry, was sidetracked on some other items until now. I think I have it working now based on the advice above. I never ran your sample report as mine appears to now be working. I don't know why it wasn't working before - this is an extremely large report - and I think the size is causing issues. I regularly have strange things happening. I created some new content in one of the sections and it just wouldn't show up. I removed it and recreated, and then that time it worked. Oh well. I believe it's working and that's the important part. Thanks for everyone's help!</p>