Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Iterate Over a Parsed Field
Iterate Over a Parsed Field [message #251460] Tue, 07 August 2007 13:37 Go to next message
Mike is currently offline MikeFriend
Messages: 28
Registered: July 2009
Junior Member
Hey, I have a "how to" question. I have a pipe delimited field in my
dataset and I want group over the dataset on the individual values
acquired from parsing that field. Can anyone think of a way to do that
without changing the dataset?

Thanks,

Mike
Re: Iterate Over a Parsed Field [message #251548 is a reply to message #251460] Tue, 07 August 2007 18:44 Go to previous message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Mike,

You can add a column in the binding that parses the pipe field and then
use this new field for grouping.

splt =row["pipecol"].split("|");
splt[1];

See attached example

Jason

<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.14"
id="1">
<property name="createdBy">Eclipse BIRT Designer Version
2.2.0.v20070620 Build &lt;2.2.0.v20070626-1003></property>
<property name="units">in</property>
<property name="comments">Copyright (c) 2007 &lt;&lt;Your Company
Name here>></property>
<html-property name="description">Creates a blank report with no
predefined content.</html-property>
<text-property name="displayName">Blank Report</text-property>
<property name="iconFile">/templates/blank_report.gif</property>
<data-sources>
<script-data-source name="Data Source" id="6"/>
</data-sources>
<data-sets>
<script-data-set name="Data Set" id="7">
<list-property name="resultSetHints">
<structure>
<property name="position">0</property>
<property name="name">pipecol</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">1</property>
<property name="name">col2</property>
<property name="dataType">integer</property>
</structure>
</list-property>
<list-property name="columnHints">
<structure>
<property name="columnName">pipecol</property>
</structure>
<structure>
<property name="columnName">col2</property>
</structure>
</list-property>
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">pipecol</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">col2</property>
<property name="dataType">integer</property>
</structure>
</list-property>
</structure>
<property name="dataSource">Data Source</property>
<method name="open"><![CDATA[tst=0;]]></method>
<method name="fetch"><![CDATA[if( tst > 10 ){
return false;
}else{
tst +=1;

row["pipecol"] = "mycolumn|" + tst%2;
row["col2"] = tst;
return true;
}]]></method>
</script-data-set>
</data-sets>
<styles>
<style name="crosstab" id="4">
<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-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>
</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="8">
<property name="width">100%</property>
<property name="dataSet">Data Set</property>
<list-property name="boundDataColumns">
<structure>
<property name="name">pipecol</property>
<expression
name="expression">dataSetRow["pipecol"]</expression>
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">col2</property>
<expression
name="expression">dataSetRow["col2"]</expression>
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">splitcol</property>
<expression name="expression">splt
=row["pipecol"].split("|");
splt[1];</expression>
<property name="dataType">string</property>
</structure>
</list-property>
<column id="22"/>
<column id="23"/>
<column id="34"/>
<header>
<row id="9">
<cell id="10">
<label id="11">
<text-property
name="text">pipecol</text-property>
</label>
</cell>
<cell id="12">
<label id="13">
<text-property name="text">col2</text-property>
</label>
</cell>
<cell id="31"/>
</row>
</header>
<group id="36">
<property name="groupName">NewTableGroup1</property>
<property name="interval">none</property>
<property name="sortDirection">asc</property>
<expression name="keyExpr">row["splitcol"]</expression>
<structure name="toc">
<expression
name="expressionValue">row["splitcol"]</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="37">
<cell id="38">
<data id="45">
<property
name="resultSetColumn">splitcol</property>
</data>
</cell>
<cell id="39"/>
<cell id="40"/>
</row>
</header>
<footer>
<row id="41">
<cell id="42"/>
<cell id="43"/>
<cell id="44"/>
</row>
</footer>
</group>
<detail>
<row id="14">
<cell id="15">
<data id="16">
<property
name="resultSetColumn">pipecol</property>
</data>
</cell>
<cell id="17">
<data id="18">
<property
name="resultSetColumn">col2</property>
</data>
</cell>
<cell id="32">
<data id="35">
<property
name="resultSetColumn">splitcol</property>
</data>
</cell>
</row>
</detail>
<footer>
<row id="19">
<cell id="20"/>
<cell id="21"/>
<cell id="33"/>
</row>
</footer>
</table>
</body>
</report>


Mike Reynolds wrote:
> Hey, I have a "how to" question. I have a pipe delimited field in my
> dataset and I want group over the dataset on the individual values
> acquired from parsing that field. Can anyone think of a way to do that
> without changing the dataset?
>
> Thanks,
>
> Mike
>
Previous Topic:'Report engine can not create pdf emitter' error
Next Topic:union of datasets
Goto Forum:
  


Current Time: Wed Jul 17 23:23:14 GMT 2024

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

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

Back to the top