Skip to main content



      Home
Home » Archived » BIRT » Fill pdf page with table / vertical lines + transport totals(Fill pdf page with table / vertical lines + transport totals)
Fill pdf page with table / vertical lines + transport totals [message #995019] Fri, 28 December 2012 17:15 Go to next message
Eclipse UserFriend
Dear all,

I am trying to create a purchase order with BIRT.
I use frameset (seperate run and render) to create the document.

I want to put the totals of the purchase order always on the bottom of the pdf.
For this I created a grid with 2 rows.
The grid has a fixed height specified, what is the space available on the page (9 inch).
This fixed height is divided over the 2 rows:
- 1st row contains table with purchase order details (8 inch) > this row is of variable height due to purchase order header & text fields
- 2nd row contains table with purchase order totals (1 inch)

The layout preference is set to auto-layout, as for fixed layout it will always generate 1 page.

This pretty much does the layout trick: the purchase order totals are always displayed on the bottom of the page, regardless of number of pages.


Now the problem is that in case of multiple pages, I also want to display transport totals (or 'running page totals') of the amounts displayed on the pages.
For auto-layout I tried 2 solutions as offered on this forum (one with pageqty, one with page variables). Both do not work.

Below an example report what demonstrates what I am trying to achieve, based on an earlier report of mr. Jason. Also in this report, the master page header value, that will only display the total of complete document instead of total per page.
Attached the pdf-result of this report.

Thanks in advance for any assistance provided.



<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.23" id="1">
<property name="createdBy">Eclipse BIRT Designer Version 4.2.1.v201209060743 Build &lt;4.2.1.v20120911-1016></property>
<property name="units">in</property>
<property name="iconFile">/templates/blank_report.gif</property>
<property name="layoutPreference">auto layout</property>
<property name="bidiLayoutOrientation">ltr</property>
<property name="imageDPI">96</property>
<data-sources>
<oda-data-source extensionID="org.eclipse.birt.report.data.oda.jdbc" name="Data Source" id="7">
<property name="odaDriverClass">org.eclipse.birt.report.data.oda.sampledb.Driver</property>
<property name="odaURL">jdbc:classicmodels:sampledb</property>
<property name="odaUser">ClassicModels</property>
<property name="OdaConnProfileName"></property>
</oda-data-source>
</data-sources>
<data-sets>
<oda-data-set extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" name="Data Set" id="8">
<list-property name="columnHints">
<structure>
<property name="columnName">ORDERNUMBER</property>
<text-property name="displayName">ORDERNUMBER</text-property>
</structure>
<structure>
<property name="columnName">PRODUCTCODE</property>
<text-property name="displayName">PRODUCTCODE</text-property>
</structure>
<structure>
<property name="columnName">QUANTITYORDERED</property>
<text-property name="displayName">QUANTITYORDERED</text-property>
</structure>
<structure>
<property name="columnName">PRICEEACH</property>
<text-property name="displayName">PRICEEACH</text-property>
</structure>
<structure>
<property name="columnName">ORDERLINENUMBER</property>
<text-property name="displayName">ORDERLINENUMBER</text-property>
</structure>
</list-property>
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">ORDERNUMBER</property>
<property name="dataType">integer</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">PRODUCTCODE</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">QUANTITYORDERED</property>
<property name="dataType">integer</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">PRICEEACH</property>
<property name="dataType">float</property>
</structure>
<structure>
<property name="position">5</property>
<property name="name">ORDERLINENUMBER</property>
<property name="dataType">integer</property>
</structure>
</list-property>
</structure>
<property name="dataSource">Data Source</property>
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">ORDERNUMBER</property>
<property name="nativeName">ORDERNUMBER</property>
<property name="dataType">integer</property>
<property name="nativeDataType">4</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">PRODUCTCODE</property>
<property name="nativeName">PRODUCTCODE</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">QUANTITYORDERED</property>
<property name="nativeName">QUANTITYORDERED</property>
<property name="dataType">integer</property>
<property name="nativeDataType">4</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">PRICEEACH</property>
<property name="nativeName">PRICEEACH</property>
<property name="dataType">float</property>
<property name="nativeDataType">8</property>
</structure>
<structure>
<property name="position">5</property>
<property name="name">ORDERLINENUMBER</property>
<property name="nativeName">ORDERLINENUMBER</property>
<property name="dataType">integer</property>
<property name="nativeDataType">5</property>
</structure>
</list-property>
<xml-property name="queryText"><![CDATA[select *
from orderdetails]]></xml-property>
<xml-property name="designerValues"><![CDATA[<?xml
version="1.0" encoding="UTF-8"?>
<model:DesignValues
xmlns:design="http://www.eclipse.org/datatools/connectivity/oda/design"
xmlns:model="http://www.eclipse.org/birt/report/model/adapter/odaModel">
<Version>1.0</Version>
<design:ResultSets derivedMetaData="true">
<design:resultSetDefinitions>
<design:resultSetColumns>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>ORDERNUMBER</design:name>
<design:position>1</design:position>
<design:nativeDataTypeCode>4</design:nativeDataTypeCode>
<design:precision>10</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>ORDERNUMBER</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>ORDERNUMBER</design:label>
<design:formattingHints>
<design:displaySize>11</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>PRODUCTCODE</design:name>
<design:position>2</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>15</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>PRODUCTCODE</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>PRODUCTCODE</design:label>
<design:formattingHints>
<design:displaySize>15</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>QUANTITYORDERED</design:name>
<design:position>3</design:position>
<design:nativeDataTypeCode>4</design:nativeDataTypeCode>
<design:precision>10</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>QUANTITYORDERED</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>QUANTITYORDERED</design:label>
<design:formattingHints>
<design:displaySize>11</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>PRICEEACH</design:name>
<design:position>4</design:position>
<design:nativeDataTypeCode>8</design:nativeDataTypeCode>
<design:precision>15</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>PRICEEACH</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>PRICEEACH</design:label>
<design:formattingHints>
<design:displaySize>22</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>ORDERLINENUMBER</design:name>
<design:position>5</design:position>
<design:nativeDataTypeCode>5</design:nativeDataTypeCode>
<design:precision>5</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>ORDERLINENUMBER</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>ORDERLINENUMBER</design:label>
<design:formattingHints>
<design:displaySize>6</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
</design:resultSetColumns>
<design:criteria/>
</design:resultSetDefinitions>
</design:ResultSets>
</model:DesignValues>]]></xml-property>
</oda-data-set>
</data-sets>
<styles>
<style name="report" id="4">
<property name="fontFamily">sans-serif</property>
<property name="fontSize">10pt</property>
</style>
<style name="crosstab-cell" id="5">
<property name="borderBottomColor">#CCCCCC</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">1pt</property>
<property name="borderLeftColor">#CCCCCC</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">1pt</property>
<property name="borderRightColor">#CCCCCC</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">1pt</property>
<property name="borderTopColor">#CCCCCC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">1pt</property>
</style>
<style name="crosstab" id="6">
<property name="borderBottomColor">#CCCCCC</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">1pt</property>
<property name="borderLeftColor">#CCCCCC</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">1pt</property>
<property name="borderRightColor">#CCCCCC</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">1pt</property>
<property name="borderTopColor">#CCCCCC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">1pt</property>
</style>
</styles>
<page-setup>
<simple-master-page name="Simple MasterPage" id="2">
<method name="onPageEnd"><![CDATA[var qtys =
this.getInstancesByElementName("qtyelement");
var tmp=0;
if( qtys != null ){
for( var i=0; i< qtys.length; i++ ){
//Instance of DataItemInstance
var qty = qtys[i];
tmp+=parseInt(qty.getValue());
}

}
reportContext.setPageVariable("pageqty",tmp);]]></method>
<page-header>
<auto-text id="44">
<property name="backgroundColor">#FF8080</property>
<property name="type">page-variable</property>
<property name="pageVariable">pageqty</property>
</auto-text>
</page-header>
<page-footer>
<auto-text id="47">
<property name="backgroundColor">#FF8040</property>
<property name="type">page-variable</property>
<property name="pageVariable">totalForAllPages</property>
</auto-text>
</page-footer>
</simple-master-page>
</page-setup>
<body>
<grid id="48">
<property name="borderBottomColor">#000000</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">thin</property>
<property name="borderLeftColor">#000000</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">thin</property>
<property name="borderRightColor">#000000</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">thin</property>
<property name="borderTopColor">#000000</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">thin</property>
<property name="verticalAlign">middle</property>
<property name="height">9in</property>
<property name="width">8in</property>
<column id="49"/>
<row id="50">
<property name="height">8in</property>
<property name="borderBottomColor">#000000</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">thin</property>
<property name="borderLeftColor">#000000</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">thin</property>
<property name="borderRightColor">#000000</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">thin</property>
<property name="borderTopColor">#000000</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">thin</property>
<cell id="51">
<table id="9">
<property name="dataSet">Data Set</property>
<list-property name="boundDataColumns">
<structure>
<property name="name">ORDERNUMBER</property>
<text-property name="displayName">ORDERNUMBER</text-property>
<expression name="expression" type="javascript">dataSetRow["ORDERNUMBER"]</expression>
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">PRODUCTCODE</property>
<text-property name="displayName">PRODUCTCODE</text-property>
<expression name="expression" type="javascript">dataSetRow["PRODUCTCODE"]</expression>
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">QUANTITYORDERED</property>
<text-property name="displayName">QUANTITYORDERED</text-property>
<expression name="expression" type="javascript">dataSetRow["QUANTITYORDERED"]</expression>
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">PRICEEACH</property>
<text-property name="displayName">PRICEEACH</text-property>
<expression name="expression" type="javascript">dataSetRow["PRICEEACH"]</expression>
<property name="dataType">float</property>
</structure>
<structure>
<property name="name">ORDERLINENUMBER</property>
<text-property name="displayName">ORDERLINENUMBER</text-property>
<expression name="expression" type="javascript">dataSetRow["ORDERLINENUMBER"]</expression>
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">Aggregation</property>
<property name="dataType">float</property>
<property name="aggregateFunction">SUM</property>
<list-property name="arguments">
<structure>
<property name="name">Expression</property>
<expression name="value" type="javascript">row["QUANTITYORDERED"]</expression>
</structure>
</list-property>
</structure>
</list-property>
<property name="pageBreakInterval">0</property>
<column id="38"/>
<column id="39"/>
<column id="40"/>
<column id="41"/>
<column id="42"/>
<header>
<row id="10">
<cell id="11">
<label id="12">
<text-property name="text">ORDERNUMBER</text-property>
</label>
</cell>
<cell id="13">
<label id="14">
<text-property name="text">PRODUCTCODE</text-property>
</label>
</cell>
<cell id="15">
<label id="16">
<text-property name="text">QUANTITYORDERED</text-property>
</label>
</cell>
<cell id="17">
<label id="18">
<text-property name="text">PRICEEACH</text-property>
</label>
</cell>
<cell id="19">
<label id="20">
<text-property name="text">ORDERLINENUMBER</text-property>
</label>
</cell>
</row>
</header>
<detail>
<row id="21">
<cell id="22">
<data id="23">
<property name="resultSetColumn">ORDERNUMBER</property>
</data>
</cell>
<cell id="24">
<data id="25">
<property name="resultSetColumn">PRODUCTCODE</property>
</data>
</cell>
<cell id="26">
<data name="qtyelement" id="27">
<property name="resultSetColumn">QUANTITYORDERED</property>
</data>
</cell>
<cell id="28">
<data id="29">
<property name="resultSetColumn">PRICEEACH</property>
</data>
</cell>
<cell id="30">
<data id="31">
<property name="resultSetColumn">ORDERLINENUMBER</property>
</data>
</cell>
</row>
</detail>
<footer>
<row id="32">
<property name="backgroundColor">#004080</property>
<cell id="33"/>
<cell id="34"/>
<cell id="35">
<data id="45">
<property name="color">#FFFFFF</property>
<method name="onCreate"><![CDATA[reportContext.setPageVariable("totalForAllPages ",this.getValue());
]]></method>
<property name="resultSetColumn">Aggregation</property>
</data>
</cell>
<cell id="36"/>
<cell id="37"/>
</row>
</footer>
</table>
</cell>
</row>
<row id="52">
<property name="height">1in</property>
<property name="borderBottomColor">#000000</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">thin</property>
<property name="borderLeftColor">#000000</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">thin</property>
<property name="borderRightColor">#000000</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">thin</property>
<property name="borderTopColor">#000000</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">thin</property>
<cell id="53">
<property name="borderBottomColor">#000000</property>
<property name="borderBottomStyle">solid</property>
<property name="borderLeftColor">#000000</property>
<property name="borderLeftStyle">solid</property>
<property name="borderRightColor">#000000</property>
<property name="borderRightStyle">solid</property>
<property name="borderTopColor">#000000</property>
<property name="borderTopStyle">solid</property>
<property name="verticalAlign">middle</property>
<text id="54">
<property name="contentType">auto</property>
<text-property name="content"><![CDATA[TOTALS .. ]]></text-property>
</text>
</cell>
</row>
</grid>
</body>
<property name="pageVariables">
<variable-element name="pageqty">
<property name="type">page</property>
</variable-element>
<variable-element name="totalForAllPages">
<property name="type">report</property>
</variable-element>
</property>
</report>
Re: Fill pdf page with table / vertical lines + transport totals [message #995045 is a reply to message #995019] Fri, 28 December 2012 19:05 Go to previous messageGo to next message
Eclipse UserFriend
With auto, you'll need to set a page break interval that isn't 0 to have what you're trying to do, work. Like, setting it back to the default of 40 would cause it to work. Without using the fixed layout, there is no page size to force page breaks, so they must be forced. Hope this helps.
Re: Fill pdf page with table / vertical lines + transport totals [message #995632 is a reply to message #995045] Sun, 30 December 2012 13:32 Go to previous messageGo to next message
Eclipse UserFriend
Thanks Michael, that is clear.

The purchase order text is the variable that is causing problems.
That may exist from multiple lines.
Because of this, unfortunately I can not set a fixed page break interval for the complete document.

Can I make the page break variable for first and other pages, fe by scripting?
If so, can you provide a piece of example code?

Thanks,
Stan
Re: Fill pdf page with table / vertical lines + transport totals [message #995986 is a reply to message #995632] Mon, 31 December 2012 13:13 Go to previous messageGo to next message
Eclipse UserFriend
Yeah. You can force page breaks in script. I've done this by computing the number of lines each row takes and keeping a total, so I can page break when necessary. Have you tried putting your final grid in the masterpage footer and just using a fixed layout?
Re: Fill pdf page with table / vertical lines + transport totals [message #997500 is a reply to message #995019] Mon, 07 January 2013 15:03 Go to previous messageGo to next message
Eclipse UserFriend
Dear Michael,

It will be the dilemma between loosing the space in the master page footer (fixed layout solution) or spent time in using line counters to determine pagebreaks with auto layout. Last option (auto layout) is too time consuming for my organisation.

We will go for the offered solutions with fixed layout and totals in master page.

Thanks for the input!

Re: Fill pdf page with table / vertical lines + transport totals [message #997519 is a reply to message #995019] Mon, 07 January 2013 20:30 Go to previous messageGo to next message
Eclipse UserFriend
Here. Try this. It's like an example I posted in the BIRT Exchange devShare a long time ago. You only have to compute the rowcnt for the last page and extend the footer to the end with an HTML text box. This example obviously only has single line rows, but you should be able to replace the rowcnt++ script in the onCreate of the detail row, pretty easily with something to compute the multiple lines. This report uses a fixed layout, but with no height set on the top cell of the grid.

Being able to use separate master pages within an element would be a good feature to have and would solve your issue. If you want to file an enhancement request for this feature, you can do so in the bugzilla. Let me know if you need help implementing this with multi-line rows, if you decide to try it.
Re: Fill pdf page with table / vertical lines + transport totals [message #1062600 is a reply to message #997519] Sun, 09 June 2013 15:15 Go to previous messageGo to next message
Eclipse UserFriend
Hi, Michael

I am facing same issue but with multi-line rows now,
Can you need help implementing this with multi-line rows.

Thanks
Ying
Re: Fill pdf page with table / vertical lines + transport totals [message #1062838 is a reply to message #1062600] Tue, 11 June 2013 00:26 Go to previous message
Eclipse UserFriend
You would just need to find a good approximation of the number of characters or words per line and use that to determine how far down the page you are. Another thing I've done to do this was to use a scripted dataSet to actually turn my multi-line rows into multiple single line rows of a dataSet, allowing for the standard row counting to work.
Previous Topic:change bars / track changes
Next Topic:ORA-01427: single-row subquery returns more than one row
Goto Forum:
  


Current Time: Mon Mar 24 16:07:31 EDT 2025

Powered by FUDForum. Page generated in 0.04682 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top