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)
Add data row multiple times (interpolate)
Jheronymus
<p>Hi,</p>
<p> </p>
<p>I have to show records for future dates in my report. I can retrieve the current record and its interval, so I can calculate future values.</p>
<p> </p>
<p>I want to add this record multiple times to the dataset, but just with a different date field. I was hoping this is possible in the fetch script of the dataset, but I'm not sure how the 'new row' is triggered.</p>
<p> </p>
<p> </p>
<p>pseudo code:</p>
<pre class="_prettyXprint">
addRow()
row['id'] = getInt('id');
row['desc'] = getString('description');
row['startdate'] = getTimestamp('startdate');
cursor = getDate('startdate')
while(cursor < params['enddate']){
cursor.addDays(getInt('interval');
addRow();
row['id'] = getInt('id');
row['desc'] = getString('description');
row['startdate'] = cursor;
}</pre>
<p>I'm not sure if this is possible at all.</p>
<p>Another way would be to fill another dataset from within the fetch script of this datascript. But I'm not sure how to proceed here. Any thoughts / examples are very welcome.</p>
<p> </p>
<p> </p>
<p> </p>
Find more posts tagged with
Comments
Clement Wong
<p>You will first need to create the Original Data Set and then save the values off. Then, you can use a Scripted Data Source/Data Set to loop through the array and build up the new data set.</p>
<p> </p>
<p>Attached is a sample based on Classic Models, created in OS BIRT 4.5. The report has a parameter for End Date and the interval (in days). The first data set has 5 rows: OrderNumber, OrderDate and Status.</p>
<p> </p>
<p>In the Scripted Data Set, we loop through and build the rows based on your pseudo code.</p>