Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Arrange Column data in a row(Arrange Column data in a row)
Arrange Column data in a row [message #559487] Thu, 16 September 2010 19:21 Go to next message
Veena  is currently offline Veena
Messages: 3
Registered: August 2010
Junior Member
Hi,

I am having some trouble with a BIRT report. I need the column data to be displayed in a row wise like below.Each row should contain only two elements as below.

What I have is this.

Code:
ID Code
A ABC
A DEF
B FGH
B GHI


Code:
ID Code
A ABC DEF
B FGH GHI


Please help me out.

Thanks.
Re: Arrange Column data in a row [message #559688 is a reply to message #559487] Fri, 17 September 2010 15:01 Go to previous message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

You should be able to group on id and then add an aggregation element to
the group header that uses the concatenate function. Finally hide the
detail row. Attached is an example.

Jason

<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.21"
id="1">
<property name="createdBy">Eclipse BIRT Designer Version
2.5.2.v20100208 Build &lt;2.5.2.v20100210-0630></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">id</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">1</property>
<property name="name">code</property>
<property name="dataType">string</property>
</structure>
</list-property>
<list-property name="columnHints">
<structure>
<property name="columnName">id</property>
</structure>
<structure>
<property name="columnName">code</property>
</structure>
</list-property>
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">id</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">code</property>
<property name="dataType">string</property>
</structure>
</list-property>
</structure>
<property name="dataSource">Data Source</property>
<method name="open"><![CDATA[ii=0;]]></method>
<method name="fetch"><![CDATA[if( ii >= 4 ) return false;

if( ii == 0 ){
row["id"] = "A";
row["code"] = "ABC";
}
if( ii == 1 ){
row["id"] = "A";
row["code"] = "DEF";
}
if( ii ==2 ){
row["id"] = "B";
row["code"] = "FGH";
}
if( ii == 3 ){
row["id"] = "B";
row["code"] = "GHI";
}
ii++;
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>
<text id="34">
<property name="contentType">auto</property>
<text-property name="content"><![CDATA[Detail row is
hidden]]></text-property>
</text>
<table id="9">
<property name="dataSet">Data Set</property>
<list-property name="boundDataColumns">
<structure>
<property name="name">id</property>
<text-property name="displayName">id</text-property>
<expression name="expression"
type="javascript">dataSetRow["id"]</expression>
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">code</property>
<text-property name="displayName">code</text-property>
<expression name="expression"
type="javascript">dataSetRow["code"]</expression>
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">Aggregation</property>
<property name="dataType">string</property>
<simple-property-list name="aggregateOn">
<value>NewTableGroup1</value>
</simple-property-list>
<property
name="aggregateFunction">CONCATENATE</property>
<list-property name="arguments">
<structure>
<property name="name">Expression</property>
<expression name="value"
type="javascript">row["code"]</expression>
</structure>
<structure>
<property name="name">Separator</property>
<expression name="value"
type="javascript">", "</expression>
</structure>
<structure>
<property name="name">Max length</property>
</structure>
<structure>
<property name="name">Show all
values</property>
</structure>
</list-property>
</structure>
</list-property>
<column id="23"/>
<column id="24"/>
<header>
<row id="10">
<cell id="11">
<label id="12">
<text-property name="text">id</text-property>
</label>
</cell>
<cell id="13">
<label id="14">
<text-property name="text">code</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["id"]</expression>
<structure name="toc">
<expression name="expressionValue"
type="javascript">row["id"]</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">id</property>
</data>
</cell>
<cell id="28">
<data id="33">
<property
name="resultSetColumn">Aggregation</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="resultSetColumn">id</property>
</data>
</cell>
<cell id="18">
<data id="19">
<property
name="resultSetColumn">code</property>
</data>
</cell>
</row>
</detail>
<footer>
<row id="20">
<cell id="21"/>
<cell id="22"/>
</row>
</footer>
</table>
</body>
</report>


On 9/16/2010 3:21 PM, Veena wrote:
> Hi,
>
> I am having some trouble with a BIRT report. I need the column data to
> be displayed in a row wise like below.Each row should contain only two
> elements as below.
>
> What I have is this.
>
> Code:
> ID Code
> A ABC
> A DEF
> B FGH
> B GHI
>
>
> Code:
> ID Code
> A ABC DEF
> B FGH GHI
>
>
> Please help me out.
>
> Thanks.
>
Previous Topic:Problem with Sorting table data
Next Topic:Bug in word exporter?
Goto Forum:
  


Current Time: Tue Sep 30 12:05:46 GMT 2014

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

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