Home
Designing Analytics Reports
Unable to display data dynamically in the rows of the BIRT table for a specific column
Migrateduser
<p>Hi,</p>
<p> </p>
<p>I am using birt-report-designer-all-in-one-4.6.0. The issue I have been facing is in displaying the data in the rows of a table. I have been pulling the row data for a data set element and trying to do some calculation dynamically and display the calculated data in the next column for all the rows.</p>
<p> </p>
<p>Initially, i tried with expression builder in the data binding for the specific column but it didn't work. I tried event handler onPrepare, onRender method but it didn't resolve the issue. I even tried to initialize the global variable in the onRender metnod but no luck.</p>
<p> </p>
<p>var count = reportContext.getPersistentGlobalVariable("ItemCount", this.getValue());</p>
<p> </p>
<div>var mytable = reportContext.getDesignHandle().findElement( "mytable" );</div>
<div>//Get number of columns</div>
<div>var columnCount = mytable.getColumnCount();</div>
<div>//Get number of detail rows</div>
<div>var rowCount = mytable.getDetail().getCount();</div>
<div> </div>
<div>for (rc=0;rc<rowCount;rc++) //For each row</div>
<div>{</div>
<div>var startDate = mytable.getDetail().get(rc).getCells( ).get(4).getContent().get(0); //Get data Item</div>
<div> </div>
<div>if(condition) </div>
<div>{</div>
<div>//row["End Date"]=BirtDateTime.addDay(startDate, 30)</div>
<div>this.setDisplayValue(BirtDateTime.addDay(row["Start Date"], 30));</div>
<div>}</div>
<div>if(other condition) </div>
<div>{</div>
<div>//row["End Date"]=BirtDateTime.addDay(startDate, 30)</div>
<div>this.setDisplayValue(BirtDateTime.addDay(row["Start Date"], 45));</div>
<div>}</div>
<div>}</div>
<p> </p>
<p>What I am trying to achieve is, i have to display 'End Date' in the table. I am pulling the data using data set from sql server data base. I am fetching 'Start Date' from the database and want to perform an operation to get 'End Date' dynamically. Let's say 'Start Date' for a row is Aug 10, 2016, I want to add 20 days to the 'Start Date' based on certain condition and need to display Aug 30, 2016 in the same row for the column 'End Date'.</p>
<p> </p>
<p>Using Data Binding, i was able to partially achieve it as it displayed the 'End Date' as per the calculations but the same value was repeated for all the subsequent rows that defeated the purpose.</p>
<p> </p>
<p>I want to do the calculations for each row and display the correct data for the required column.</p>
<p> </p>
<p>Any help/guidance to achieve it will be highly appreciated.</p>
<p> </p>
<p>Thanks in advance.</p>
<p> </p>
<p>Deo</p>
<p> </p>
Find more posts tagged with
Comments
There are no comments yet