|
Re: Dataset row count [message #552099 is a reply to message #552064] |
Tue, 10 August 2010 20:03 |
John Ward Messages: 16 Registered: July 2009 |
Junior Member |
|
|
This is a multi-part message in MIME format.
--------------080302040909040903010603
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
What I would recommend is drop your table into the report, and use an
Aggregate count, which will create a new table binding. Create a row in
the header for your table, and put your summary in there. This will let
you access the binding.
John
On 8/10/2010 11:52 AM, Sorceror wrote:
> Hello guys,
> I'm quite new in BIRT reporting and I just cannot find way how to obtain
> count of rows in dataset.
> Here's the thing. In the top on my report is summary table with parametr
> values, day of creation etc. and one of them should be total number of
> results which are displayed in details in table which follows.
> Thanks for any help
> Paul
--------------080302040909040903010603
Content-Type: text/xml;
name="sampleReport.rptdesign"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="sampleReport.rptdesign"
<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.17" id="1">
<property name="createdBy">Eclipse BIRT Designer Version 2.3.2.r232_v20090521 Build <2.3.2.v20090601-0700></property>
<property name="units">in</property>
<property name="iconFile">/templates/blank_report.gif</property>
<property name="bidiLayoutOrientation">ltr</property>
<data-sources>
<oda-data-source extensionID="org.eclipse.birt.report.data.oda.jdbc" name="Data Source" id="32">
<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="33">
<list-property name="columnHints">
<structure>
<property name="columnName">CUSTOMERNAME</property>
<property name="displayName">CUSTOMERNAME</property>
</structure>
<structure>
<property name="columnName">CONTACTLASTNAME</property>
<property name="displayName">CONTACTLASTNAME</property>
</structure>
<structure>
<property name="columnName">CONTACTFIRSTNAME</property>
<property name="displayName">CONTACTFIRSTNAME</property>
</structure>
<structure>
<property name="columnName">PHONE</property>
<property name="displayName">PHONE</property>
</structure>
</list-property>
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">CUSTOMERNAME</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">CONTACTLASTNAME</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">CONTACTFIRSTNAME</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">PHONE</property>
<property name="dataType">string</property>
</structure>
</list-property>
</structure>
<property name="dataSource">Data Source</property>
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">CUSTOMERNAME</property>
<property name="nativeName">CUSTOMERNAME</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">CONTACTLASTNAME</property>
<property name="nativeName">CONTACTLASTNAME</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">CONTACTFIRSTNAME</property>
<property name="nativeName">CONTACTFIRSTNAME</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">PHONE</property>
<property name="nativeName">PHONE</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
</list-property>
<property name="queryText">select CUSTOMERNAME,
CONTACTLASTNAME,
CONTACTFIRSTNAME,
PHONE
from
CUSTOMERS</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>CUSTOMERNAME</design:name>
<design:position>1</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>50</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CUSTOMERNAME</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CUSTOMERNAME</design:label>
<design:formattingHints>
<design:displaySize>50</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CONTACTLASTNAME</design:name>
<design:position>2</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>50</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CONTACTLASTNAME</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CONTACTLASTNAME</design:label>
<design:formattingHints>
<design:displaySize>50</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CONTACTFIRSTNAME</design:name>
<design:position>3</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>50</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CONTACTFIRSTNAME</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CONTACTFIRSTNAME</design:label>
<design:formattingHints>
<design:displaySize>50</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>PHONE</design:name>
<design:position>4</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>50</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>PHONE</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>PHONE</design:label>
<design:formattingHints>
<design:displaySize>50</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">
<page-footer>
<text id="3">
<property name="contentType">html</property>
<text-property name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property>
</text>
</page-footer>
</simple-master-page>
</page-setup>
<body>
<grid id="7">
<property name="height">1.28125in</property>
<column id="8"/>
<row id="9">
<cell id="10">
<label id="11">
<property name="fontWeight">bold</property>
<property name="fontStyle">normal</property>
<property name="textUnderline">underline</property>
<property name="textAlign">center</property>
<text-property name="text">SAMPLE REPORT</text-property>
</label>
<table id="56">
<property name="dataSet">Data Set</property>
<list-property name="boundDataColumns">
<structure>
<property name="name">CUSTOMERNAME</property>
<property name="displayName">CUSTOMERNAME</property>
<expression name="expression">dataSetRow["CUSTOMERNAME"]</expression >
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">CONTACTLASTNAME</property>
<property name="displayName">CONTACTLASTNAME</property>
<expression name="expression">dataSetRow["CONTACTLASTNAME"]</expression >
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">CONTACTFIRSTNAME</property>
<property name="displayName">CONTACTFIRSTNAME</property>
<expression name="expression">dataSetRow["CONTACTFIRSTNAME"]</expression >
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">PHONE</property>
<property name="displayName">PHONE</property>
<expression name="expression">dataSetRow["PHONE"]</expression>
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">FullName</property>
<property name="displayName">FullName</property>
<expression name="expression">dataSetRow["CONTACTFIRSTNAME"] + " " + dataSetRow["CONTACTLASTNAME"]</expression>
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">Column Binding</property>
<expression name="expression">"I display the date: " + new Date()</expression>
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">rowCount</property>
<property name="dataType">integer</property>
<property name="aggregateFunction">COUNT</property>
<list-property name="arguments">
<structure>
<property name="name">Expression</property>
</structure>
</list-property>
</structure>
<structure>
<property name="name">Column Binding_1</property>
<expression name="expression">row.__rownum + 1</expression>
<property name="dataType">string</property>
</structure>
</list-property>
<column id="103"/>
<column id="80"/>
<column id="83"/>
<header>
<row id="84">
<property name="fontWeight">bold</property>
<property name="textAlign">left</property>
<cell id="99"/>
<cell id="85">
<property name="colSpan">2</property>
<property name="rowSpan">1</property>
<grid id="87">
<property name="width">100%</property>
<column id="88"/>
<column id="89"/>
<column id="90"/>
<row id="91">
<cell id="92">
<label id="95">
<text-property name="text">I am displaying some Summary Date here</text-property>
</label>
</cell>
<cell id="93">
<data id="96">
<property name="resultSetColumn">Column Binding</property>
</data>
</cell>
<cell id="94">
<label id="98">
<text-property name="text">Row Count</text-property>
</label>
<data id="97">
<property name="resultSetColumn">rowCount</property>
</data>
</cell>
</row>
</grid>
</cell>
</row>
<row id="57">
<property name="fontWeight">bold</property>
<property name="textAlign">left</property>
<cell id="100"/>
<cell id="58">
<label id="59">
<text-property name="text">CUSTOMERNAME</text-property>
</label>
</cell>
<cell id="64">
<label id="65">
<text-property name="text">PHONE</text-property>
</label>
</cell>
</row>
</header>
<detail>
<row id="66">
<cell id="101">
<data id="104">
<property name="resultSetColumn">Column Binding_1</property>
</data>
</cell>
<cell id="67">
<data id="68">
<property name="resultSetColumn">CUSTOMERNAME</property>
<structure name="action">
<property name="linkType">hyperlink</property>
<expression name="uri">"http://www.google.com?\"" + row["FullName"] + "\""</expression>
<property name="targetWindow">_blank</property>
</structure>
</data>
</cell>
<cell id="73">
<data id="74">
<property name="resultSetColumn">PHONE</property>
</data>
</cell>
</row>
</detail>
<footer>
<row id="75">
<cell id="102"/>
<cell id="76"/>
<cell id="79"/>
</row>
</footer>
</table>
</cell>
</row>
</grid>
</body>
</report>
--------------080302040909040903010603--
|
|
|
|
|
Re: Dataset row count [message #553548 is a reply to message #552204] |
Tue, 17 August 2010 22:42 |
Tom Yamada Messages: 12 Registered: July 2009 |
Junior Member |
|
|
The pageNumber is not available to you until render-time, so using it with visibility is unlikely to be the solution you seek.
And sorry for the late reply, but if you haven't already figured out a way around that, here's a quick approach. This solution is based on John's example report above with a couple of changes.
1) Add a computed column having a constant value to the dataset.
2) Update the table bindings to recognize your new column.
3) Above the detail row of the table insert a group.
4) Set the group to group on your new columns value.
5) Move your second table header row column-head labels onto the group header row.
6) Set the group "Repeat Header" to true.
7) Set the table "Repeat Header" to false.
6) Delete the now-empty second table header row.
That should do the trick!
[Updated on: Tue, 17 August 2010 22:47] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.04775 seconds