Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Group and summarize results of a dataset(Dataset - summarize)
Group and summarize results of a dataset [message #667113] Tue, 26 April 2011 19:33 Go to next message
gin1975  is currently offline gin1975 Friend
Messages: 30
Registered: April 2011
Member
Hello,

I'm trying to prepare a report that can be displayed in the detailed version and a more condensed version. I give you an example output from a dataset of 4 columns:

1 - Product1 - Ok
2 - Product1 - Ok
3 - product2 - - Ok
4 - Product3 - - Nok
5 - Product3 - - Nok

The idea is to generate a report that compiles the information obtained in the previous dataset as follows:

Product1 - Ok
Product2 - Ok
Product3 - Nok

Can you tell me how you can group and summarize the information obtained in that dataset? I tried to group the products (Product1, product2 and Product3) using the "Groups" but I sample as follows:

Product1
Product1 - Ok
Product1 - Ok
Product2
Product2 - Ok
Product3
Product3 - NOK
Product3 - NOK

Is there another way of grouping the information obtained in that dataset in such a way that shows only one result per product?

Thanks.
Re: Group and summarize results of a dataset [message #667120 is a reply to message #667113] Tue, 26 April 2011 20:09 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

All you have to do after you do your group is move the ok nok data item
to the group header and either hide or delete the table detail row. I
re-created your example using a scripted dataset and used the visibility
setting for the detail row to hide it.

Jason

<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.22"
id="1">
<property name="createdBy">Eclipse BIRT Designer Version
2.6.1.v20100902 Build &lt;2.6.1.v20100915-1750></property>
<property name="units">in</property>
<property name="iconFile">/templates/blank_report.gif</property>
<property name="bidiLayoutOrientation">ltr</property>
<property name="imageDPI">96</property>
<data-sources>
<script-data-source name="Data Source" id="7"/>
</data-sources>
<data-sets>
<script-data-set name="Data Set" id="8">
<list-property name="resultSetHints">
<structure>
<property name="position">0</property>
<property name="name">product</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">1</property>
<property name="name">status</property>
<property name="dataType">string</property>
</structure>
</list-property>
<list-property name="columnHints">
<structure>
<property name="columnName">product</property>
</structure>
<structure>
<property name="columnName">status</property>
</structure>
</list-property>
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">product</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">status</property>
<property name="dataType">string</property>
</structure>
</list-property>
</structure>
<property name="dataSource">Data Source</property>
<method name="open"><![CDATA[i= 1;]]></method>
<method name="fetch"><![CDATA[if( i > 5 ) return false;
if( i == 1 || i == 2 ){
row["product"]= "Product1";
row["status"]= "Ok";
}
if( i == 3 ){
row["product"]= "Product2";
row["status"]= "Ok";
}
if( i == 4 || i == 5 ){
row["product"]= "Product3";
row["status"]= "Nok";
}
i++;
return true;
]]></method>
</script-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>
<table id="9">
<property name="dataSet">Data Set</property>
<list-property name="boundDataColumns">
<structure>
<property name="name">product</property>
<text-property
name="displayName">product</text-property>
<expression name="expression"
type="javascript">dataSetRow["product"]</expression>
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">status</property>
<text-property
name="displayName">status</text-property>
<expression name="expression"
type="javascript">dataSetRow["status"]</expression>
<property name="dataType">string</property>
</structure>
</list-property>
<column id="23"/>
<column id="24"/>
<header>
<row id="10">
<cell id="11">
<label id="12">
<text-property
name="text">product</text-property>
</label>
</cell>
<cell id="13">
<label id="14">
<text-property
name="text">status</text-property>
</label>
</cell>
</row>
</header>
<group id="25">
<property name="groupName">NewTableGroup1</property>
<property name="interval">none</property>
<property name="sortDirection">asc</property>
<expression name="keyExpr"
type="javascript">row["product"]</expression>
<structure name="toc">
<expression name="expressionValue"
type="javascript">row["product"]</expression>
</structure>
<property name="repeatHeader">true</property>
<property name="hideDetail">false</property>
<property name="pageBreakAfter">auto</property>
<property name="pageBreakBefore">auto</property>
<property name="pageBreakInside">auto</property>
<header>
<row id="26">
<cell id="27">
<data id="32">
<property
name="resultSetColumn">product</property>
</data>
</cell>
<cell id="28">
<data id="19">
<property
name="whiteSpace">nowrap</property>
<property
name="resultSetColumn">status</property>
</data>
</cell>
</row>
</header>
<footer>
<row id="29">
<cell id="30"/>
<cell id="31"/>
</row>
</footer>
</group>
<detail>
<row id="15">
<list-property name="visibility">
<structure>
<property name="format">all</property>
<expression name="valueExpr"
type="javascript">true</expression>
</structure>
</list-property>
<cell id="16">
<data id="17">
<property name="whiteSpace">nowrap</property>
<property
name="resultSetColumn">product</property>
</data>
</cell>
<cell id="18"/>
</row>
</detail>
<footer>
<row id="20">
<cell id="21"/>
<cell id="22"/>
</row>
</footer>
</table>
</body>
</report>


On 4/26/2011 3:33 PM, gin1975 wrote:
> 1 - Product1 - Ok
> 2 - Product1 - Ok
> 3 - product2 - - Ok
> 4 - Product3 - - Nok
> 5 - Product3 - - Nok
Previous Topic:SQL data set to set a global variable
Next Topic:TCR BIRT Javascript failed to call java class
Goto Forum:
  


Current Time: Fri Apr 19 12:39:29 GMT 2024

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

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

Back to the top