Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
field is a list of comma separated values
HSMorales
I have a dataset created from a stored procedure.
The procedure returns 3 fields.
Life_Ins, Empl_name, Bens.
Life_Ins contains a list of comma seperated values such as "Ins1,Ins2,Ins3".
Bens contains a list of comma seperated values such as "Spouse,Son,Daughter,Aunt,Uncle"
How can I get the values in Life_Ins and Bens to be stacked in list form in the detail section of my report??
Thanks for all your help.
Find more posts tagged with
Comments
johnw
Take a look at the following example.
The way I did this was I created a Scripted Data Set with a single parameter. On the open event, I split the value of that parameter into an array. For the fetch, I just get the element in the array and compare the size of the array to the current count. In my report design, I have a table that has columns with comma separated values. I pass the comma separated values in as parameter values into a sub table bound to the scripted data set. This will give me a list. The list can be variable, and the data set can be re-used (which is what I did in both columns.
johnw
I can't upload for some reason, the source is attached:
<?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 3.7.2.v20120213 Build <3.7.2.v20120214-1408></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"/>
<script-data-source name="srcColAsList" id="26"/>
</data-sources>
<data-sets>
<script-data-set name="Data Set" id="8">
<list-property name="resultSetHints">
<structure>
<property name="position">1</property>
<property name="name">c1</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">c2</property>
<property name="dataType">string</property>
</structure>
</list-property>
<list-property name="columnHints">
<structure>
<property name="columnName">c1</property>
</structure>
<structure>
<property name="columnName">c2</property>
</structure>
</list-property>
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">c1</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">c2</property>
<property name="dataType">string</property>
</structure>
</list-property>
</structure>
<property name="dataSource">Data Source</property>
<method name="open"><![CDATA[cnt = 0;]]></method>
<method name="fetch"><![CDATA[if (cnt < 3)
{
row["c1"] = "a,b,c";
row["c2"] = "Spouse,Son,Daughter,Aunt,Uncle";
cnt++;
return (true);
}
return (false);]]></method>
</script-data-set>
<script-data-set name="setColAsList" id="27">
<list-property name="resultSetHints">
<structure>
<property name="position">0</property>
<property name="name">value</property>
<property name="dataType">string</property>
</structure>
</list-property>
<list-property name="columnHints">
<structure>
<property name="columnName">value</property>
</structure>
</list-property>
<list-property name="parameters">
<structure>
<property name="name">inValue</property>
<property name="dataType">string</property>
<property name="position">1</property>
<property name="isInput">true</property>
<property name="isOutput">false</property>
</structure>
</list-property>
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">value</property>
<property name="dataType">string</property>
</structure>
</list-property>
</structure>
<property name="dataSource">srcColAsList</property>
<method name="open"><![CDATA[valAsList = this.getInputParameterValue("inValue").split(",");
cnt = 0;]]></method>
<method name="fetch"><![CDATA[if (cnt < valAsList.length)
{
row["value"] = valAsList[cnt];
cnt++;
return (true);
}
return (false);]]></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">c1</property>
<text-property name="displayName">c1</text-property>
<expression name="expression" type="javascript">dataSetRow["c1"]</expression>
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">c2</property>
<text-property name="displayName">c2</text-property>
<expression name="expression" type="javascript">dataSetRow["c2"]</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">c1</text-property>
</label>
</cell>
<cell id="13">
<label id="14">
<text-property name="text">c2</text-property>
</label>
</cell>
</row>
</header>
<detail>
<row id="15">
<cell id="16">
<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>
<table id="28">
<property name="dataSet">setColAsList</property>
<list-property name="paramBindings">
<structure>
<property name="paramName">inValue</property>
<simple-property-list name="expression">
<value type="javascript">row["c1"]</value>
</simple-property-list>
</structure>
</list-property>
<list-property name="boundDataColumns">
<structure>
<property name="name">value</property>
<text-property name="displayName">value</text-property>
<expression name="expression" type="javascript">dataSetRow["value"]</expression>
<property name="dataType">string</property>
</structure>
</list-property>
<column id="37"/>
<detail>
<row id="32">
<cell id="33">
<data id="34">
<property name="resultSetColumn">value</property>
</data>
</cell>
</row>
</detail>
</table>
</cell>
<cell id="18">
<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>
<table id="38">
<property name="dataSet">setColAsList</property>
<list-property name="paramBindings">
<structure>
<property name="paramName">inValue</property>
<simple-property-list name="expression">
<value type="javascript">row["c2"]</value>
</simple-property-list>
</structure>
</list-property>
<list-property name="boundDataColumns">
<structure>
<property name="name">value</property>
<text-property name="displayName">value</text-property>
<expression name="expression" type="javascript">dataSetRow["value"]</expression>
<property name="dataType">string</property>
</structure>
</list-property>
<column id="47"/>
<detail>
<row id="42">
<cell id="43">
<data id="44">
<property name="resultSetColumn">value</property>
</data>
</cell>
</row>
</detail>
</table>
</cell>
</row>
</detail>
<footer>
<row id="20">
<cell id="21"/>
<cell id="22"/>
</row>
</footer>
</table>
</body>
</report>
mwilliams
John, I'm not sure why the upload for certain .rptdesign files doesn't work sometimes, but it's not the uploader not working at all, it's just that file. If you put the design in a zip file, it'll let you upload. I'll report that there's an issue with 3.7.2 files not uploading.
HSMorales
Is ther a way I could create a computed field from the original field and replace "," with a CLr ??
if so, what syntax would I use??
Thanks.
I am running version 3.7.0