Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
wrap text after n characters in BIRT report
abhijitKol
<p>Dear All,</p><p>I have a report where more than 100 network ids are coming seperated as "," in an output column. I need to wrap this entire string lets say after 30 networkid's.</p><p> </p><p>How to do that in BIRT report?</p><p> </p><p> </p><p>Thanks in advance</p><p>Abhijit</p>
Find more posts tagged with
Comments
kclark
<p>You can seperate a comma delimited string into an ArrayList and which will make the values easier to work with. Are the network ID's supposed to be displayed in the same cell in your table grid and get a new line every n ID. You could also create a scripted data set so each network ID has it's own row in your table assuming that what your using to display them.</p>
abhijitKol
<p>all the id's need to be displayed in a single cell of a table. All the id's are getting displayed in the cell but as all those datas are "," seperatted, so system is taking it as a string and displaying in a single row.I need to display it in a cell by splitting/wrap those data.</p><p>String is as follows:</p><p>1234567,547657,6789034,2345682,3045761,2396007</p><p> </p><p>Output should be in the following format</p><p>1234567,547657,6789034,</p><p>2345682,3045761,2396007</p>
johnw
<p>BIRT can't wrap if there isn't whitespace to wrap on. Take a look at the attached example. </p><p> </p><p>In it, I added the string you mention. I am using Javas String ReplaceAll() method to replace the commas with comma and spaces. Then I hard coded the size of the column containing the string. As long as there is valid whitespace, line wrapping should work as expected.</p><pre class="_prettyXprint _lang-xml"><?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 4.2.1.v201209101448 Build <4.2.1.v20120912-1721></property> <property name="units">in</property> <method name="initialize"><![CDATA[var jsonstring = params["JSON Parameter"].value;jsonObject = eval( '(' + jsonstring + ')' ) ;]]></method> <property name="iconFile">/templates/blank_report.gif</property> <property name="bidiLayoutOrientation">ltr</property> <property name="imageDPI">96</property> <parameters> <scalar-parameter name="JSON Parameter" id="7"> <property name="valueType">static</property> <property name="dataType">string</property> <property name="distinct">true</property> <simple-property-list name="defaultValue"> <value type="javascript">"{ "dateArray": [{"date" : 1041832800000, "value" : 4080.0}" + ", {"date" : 1041832800000, "value" : 2754.5}" + ", {"date" : 1041832800000, "value" : 1660.12}" + ", {"date" : 1041832800000, "value" : 1729.21}" + ", {"date" : 1042092000000, "value" : 2701.5}" + ", {"date" : 1042092000000, "value" : 4343.56}" + ", {"date" : 1042092000000, "value" : 1463.8500000000001}" + ", {"date" : 1042092000000, "value" : 2040.1000000000001} " + "] } "</value> </simple-property-list> <list-property name="selectionList"/> <property name="paramType">simple</property> <property name="controlType">text-box</property> <structure name="format"> <property name="category">Unformatted</property> </structure> </scalar-parameter> </parameters> <data-sources> <script-data-source name="Data Source" id="9"/> </data-sources> <data-sets> <script-data-set name="jsonDataSet" id="10"> <list-property name="resultSetHints"> <structure> <property name="position">1</property> <property name="name">date</property> <property name="dataType">string</property> </structure> <structure> <property name="position">2</property> <property name="name">value</property> <property name="dataType">string</property> </structure> <structure> <property name="position">3</property> <property name="name">wrappedText</property> <property name="dataType">string</property> </structure> </list-property> <list-property name="columnHints"> <structure> <property name="columnName">date</property> </structure> <structure> <property name="columnName">value</property> </structure> <structure> <property name="columnName">wrappedText</property> </structure> </list-property> <structure name="cachedMetaData"> <list-property name="resultSet"> <structure> <property name="position">1</property> <property name="name">date</property> <property name="dataType">string</property> </structure> <structure> <property name="position">2</property> <property name="name">value</property> <property name="dataType">string</property> </structure> <structure> <property name="position">3</property> <property name="name">wrappedText</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 < jsonObject.dateArray.length){ row["date"] = jsonObject.dateArray[cnt].date; row["value"] = jsonObject.dateArray[cnt].value; row["wrappedText"] = "1234567,547657,6789034,2345682,3045761,2396007"; 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="91"> <property name="width">6in</property> <property name="dataSet">jsonDataSet</property> <list-property name="boundDataColumns"> <structure> <property name="name">date</property> <text-property name="displayName">date</text-property> <expression name="expression" type="javascript">dataSetRow["date"]</expression> <property name="dataType">string</property> </structure> <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> <structure> <property name="name">wrappedText</property> <text-property name="displayName">wrappedText</text-property> <expression name="expression" type="javascript">var s = new Packages.java.lang.String(dataSetRow["wrappedText"]); s.replaceAll(",", ", ");</expression> <property name="dataType">string</property> <property name="allowExport">true</property> </structure> </list-property> <column id="110"> <property name="width">2in</property> </column> <column id="111"> <property name="width">2in</property> </column> <column id="112"> <property name="width">2in</property> </column> <header> <row id="92"> <cell id="93"> <label id="94"> <text-property name="text">date</text-property> </label> </cell> <cell id="95"> <label id="96"> <text-property name="text">value</text-property> </label> </cell> <cell id="97"> <label id="98"> <text-property name="text">wrappedText</text-property> </label> </cell> </row> </header> <detail> <row id="99"> <list-property name="highlightRules"> <structure> <property name="operator">eq</property> <property name="backgroundColor">#C0C0C0</property> <expression name="testExpr" type="javascript">row.__rownum % 2</expression> <simple-property-list name="value1"> <value type="javascript">0</value> </simple-property-list> </structure> </list-property> <cell id="100"> <data id="101"> <property name="resultSetColumn">date</property> </data> </cell> <cell id="102"> <data id="103"> <property name="resultSetColumn">value</property> </data> </cell> <cell id="104"> <data id="105"> <property name="resultSetColumn">wrappedText</property> </data> </cell> </row> </detail> <footer> <row id="106"> <cell id="107"/> <cell id="108"/> <cell id="109"/> </row> </footer> </table> </body></report></pre>