Modify Row Data of the table in BIRT
<p style="color:rgb(0,0,0);font-family:Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;">I want to change the data present in the row of the table which I used for grouping purpose in the BIRT. I know how to retrieve the value but I want to change the rendering value, precisely I want to transform the string. I checked an example on official page <a data-ipb='nomediaparse' href='https://www.eclipse.org/birt/phoenix/deploy/reportScripting.php'>here</a>:</p><p><span style="margin:0px;background-color:transparent;color:rgb(0,0,139);">if</span><span style="margin:0px;background-color:transparent;"> </span><span style="margin:0px;background-color:transparent;">(</span><span style="margin:0px;background-color:transparent;color:rgb(0,0,139);">this</span><span style="margin:0px;background-color:transparent;">.</span><span style="margin:0px;background-color:transparent;">getRowData</span><span style="margin:0px;background-color:transparent;">().</span><span style="margin:0px;background-color:transparent;">getExpressionValue</span><span style="margin:0px;background-color:transparent;">(</span><span style="margin:0px;background-color:transparent;color:rgb(128,0,0);">3</span><span style="margin:0px;background-color:transparent;">)</span><span style="margin:0px;background-color:transparent;"> </span><span style="margin:0px;background-color:transparent;">></span><span style="margin:0px;background-color:transparent;"> </span><span style="margin:0px;background-color:transparent;color:rgb(128,0,0);">100</span><span style="margin:0px;background-color:transparent;">)</span><br />
<span style="margin:0px;background-color:transparent;color:rgb(0,0,139);">this</span><span style="margin:0px;background-color:transparent;">.</span><span style="margin:0px;background-color:transparent;">getStyle</span><span style="margin:0px;background-color:transparent;">().</span><span style="margin:0px;background-color:transparent;">backgroundColor</span><span style="margin:0px;background-color:transparent;">=</span><span style="margin:0px;background-color:transparent;color:rgb(128,0,0);">"red"</span><span style="margin:0px;background-color:transparent;">;</span><span style="margin:0px;background-color:transparent;color:rgb(128,128,128);">//This will only change the row instance</span></p><p> </p><p>[color=rgb(0,0,0);font-family:Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;]This is helpful to change the style of the text but I want to change the text rather than the style[/color]</p><p><span style="margin:0px;background-color:transparent;color:rgb(0,0,139);">var</span><span style="margin:0px;background-color:transparent;"> t </span><span style="margin:0px;background-color:transparent;">=</span><span style="margin:0px;background-color:transparent;"> </span><span style="margin:0px;background-color:transparent;color:rgb(0,0,139);">this</span><span style="margin:0px;background-color:transparent;">.</span><span style="margin:0px;background-color:transparent;">getRowData</span><span style="margin:0px;background-color:transparent;">().</span><span style="margin:0px;background-color:transparent;">getExpressionValue</span><span style="margin:0px;background-color:transparent;">(</span><span style="margin:0px;background-color:transparent;color:rgb(128,0,0);">"row[colname]"</span><span style="margin:0px;background-color:transparent;">);</span><br />
<span style="margin:0px;background-color:transparent;">t</span><span style="margin:0px;background-color:transparent;">=</span><span style="margin:0px;background-color:transparent;"> t</span><span style="margin:0px;background-color:transparent;">.</span><span style="margin:0px;background-color:transparent;">toUpperCase</span><span style="margin:0px;background-color:transparent;">();</span><span style="margin:0px;background-color:transparent;"> </span><span style="margin:0px;background-color:transparent;color:rgb(128,128,128);">//any string transformation</span><br />
<span style="margin:0px;background-color:transparent;color:rgb(0,0,139);">this</span><span style="margin:0px;background-color:transparent;">.</span><span style="margin:0px;background-color:transparent;">valueExpr </span><span style="margin:0px;background-color:transparent;">=</span><span style="margin:0px;background-color:transparent;"> t</span><span style="margin:0px;background-color:transparent;">;</span><span style="margin:0px;background-color:transparent;"> </span><span style="margin:0px;background-color:transparent;color:rgb(128,128,128);">//this is not working</span></p><p> </p><p>[color=rgb(0,0,0);font-family:Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;]So how to assign new string to the row. I write this script at onRender event of the row. But it is not working. Any Idea?[/color]</p>
<span style="margin:0px;background-color:transparent;color:rgb(0,0,139);">this</span><span style="margin:0px;background-color:transparent;">.</span><span style="margin:0px;background-color:transparent;">getStyle</span><span style="margin:0px;background-color:transparent;">().</span><span style="margin:0px;background-color:transparent;">backgroundColor</span><span style="margin:0px;background-color:transparent;">=</span><span style="margin:0px;background-color:transparent;color:rgb(128,0,0);">"red"</span><span style="margin:0px;background-color:transparent;">;</span><span style="margin:0px;background-color:transparent;color:rgb(128,128,128);">//This will only change the row instance</span></p><p> </p><p>[color=rgb(0,0,0);font-family:Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;]This is helpful to change the style of the text but I want to change the text rather than the style[/color]</p><p><span style="margin:0px;background-color:transparent;color:rgb(0,0,139);">var</span><span style="margin:0px;background-color:transparent;"> t </span><span style="margin:0px;background-color:transparent;">=</span><span style="margin:0px;background-color:transparent;"> </span><span style="margin:0px;background-color:transparent;color:rgb(0,0,139);">this</span><span style="margin:0px;background-color:transparent;">.</span><span style="margin:0px;background-color:transparent;">getRowData</span><span style="margin:0px;background-color:transparent;">().</span><span style="margin:0px;background-color:transparent;">getExpressionValue</span><span style="margin:0px;background-color:transparent;">(</span><span style="margin:0px;background-color:transparent;color:rgb(128,0,0);">"row[colname]"</span><span style="margin:0px;background-color:transparent;">);</span><br />
<span style="margin:0px;background-color:transparent;">t</span><span style="margin:0px;background-color:transparent;">=</span><span style="margin:0px;background-color:transparent;"> t</span><span style="margin:0px;background-color:transparent;">.</span><span style="margin:0px;background-color:transparent;">toUpperCase</span><span style="margin:0px;background-color:transparent;">();</span><span style="margin:0px;background-color:transparent;"> </span><span style="margin:0px;background-color:transparent;color:rgb(128,128,128);">//any string transformation</span><br />
<span style="margin:0px;background-color:transparent;color:rgb(0,0,139);">this</span><span style="margin:0px;background-color:transparent;">.</span><span style="margin:0px;background-color:transparent;">valueExpr </span><span style="margin:0px;background-color:transparent;">=</span><span style="margin:0px;background-color:transparent;"> t</span><span style="margin:0px;background-color:transparent;">;</span><span style="margin:0px;background-color:transparent;"> </span><span style="margin:0px;background-color:transparent;color:rgb(128,128,128);">//this is not working</span></p><p> </p><p>[color=rgb(0,0,0);font-family:Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;]So how to assign new string to the row. I write this script at onRender event of the row. But it is not working. Any Idea?[/color]</p>
0
Comments
-
<p>This question has two answers at <a data-ipb='nomediaparse' href='http://stackoverflow.com/questions/22552512/modify-row-data-of-the-table-in-birt/22563162#22563162'>http://stackoverflow.com/questions/22552512/</a></p>Warning No formatter is installed for the format ipb0
-
<p>or you can use the built in Map functionality. Once you select a data item there are 3 tabs in the property explorer. Properties, Binding, and Map. In the Map you can map the data to anything you want.</p>0
-
<p>To modify the row data, add the following script to the <strong>onRender</strong> event of the <strong>Data</strong> element (select the data element):</p>
<pre class="_prettyXprint">
if(this.getValue().toLowerCase()=="complete"){this.setDisplayValue("Task Complete")}
if(this.getValue().toLowerCase()=="in_progress"){this.setDisplayValue("Work in Progress")}
if(this.getValue().toLowerCase()=="not_started"){this.setDisplayValue("Not Started")}</pre>0
Categories
- All Categories
- 108 Developer Announcements
- 53 Articles
- 106 General Questions
- 144 IM Services
- 43 OpenText Hackathon
- 32 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 899 Cloud Fax and Notifications
- 77 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 120 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management