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)
How to loop through data set values for a yesterday hourly report?
Robsen
<p>Hello.<br><br>
I have a Web Service data source which allows me to provide a timestamp and a name parameter.<br>
It then returns a number for that 2 parameters.<br><br>
E.g. 2015.06.15 12:00:00 Value1 => Result: 42</p>
<p> </p>
<p><strong>Goal: </strong><br>
Is to create an automated report with yesterdays numbers, one for each hour and for several name parameters.</p>
<p>
Find more posts tagged with
Comments
Clement Wong
<p>You can use nested tables. The outer table would return the last 24 hours. For each row, it would return the timestamp and the name parameter. The inner table would run against your web service data source, and the input values to the web services call would come from the results of outer table row.</p>
<p> </p>
<p>Examples:</p>
<p><a data-ipb='nomediaparse' href='
https://wiki.eclipse.org/Nested_Tables_using_two_Scripted_data_sets_(BIRT)'>https://wiki.eclipse.org/Nested_Tables_using_two_Scripted_data_sets_(BIRT)</a></p>
;
<p><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/files/file/1103-nested-data-sets-with-input-parameters/'>http://developer.actuate.com/community/forum/index.php?/files/file/1103-nested-data-sets-with-input-parameters/</a></p>
;
<p> </p>
<p> </p>
<p>BTW, I wasn't able to get much out of your attached design example. There wasn't a data source or data set. Just one data report item with formatted date/time.</p>
Robsen
<p>Hallo.</p>
<p> </p>
<p>Thank your for your quick reply.<br>
Sorry for the bad design file, i attached the finished rptdesign file now.<br>
Clement Wong
<p>The attached example illustrates using a scripted data set in the outer table. Now, I didn't have a web service available that used date/time so I used a web service that returned location and timezone information for a given zip code. The outer scripted data set would increment the zip code by 1, and stops after 2 records.</p>
<p> </p>
<p>I left comments in the attached report design pointing out that you'll need to increment the scripted data counter until 23 to cycle through the last 24 hourly timestamps. This part of the code will generate the date/time starting with yesterday at midnight and increment hourly until the 24 hourly times have been generated.</p>
<p> </p>
<p><span style="font-family:'courier new', courier, monospace;">row["Time"]= BirtDateTime.addHour(BirtDateTime.addDay(BirtDateTime.today(),-1),currentrow)</span></p>
<p> </p>
<p>To create this report, I have an outer table (bound to the scripted data set). In the detail row, I dropped in the web service data set. You will now have an inner table. For the inner table, I changed the <em>Binding > Data Set Parameter Binding... </em>to the outer table zip code column. In your case, it would be the date / time.</p>
<p> </p>
<p>
Robsen
<p>Hello Clement,</p>
<p> </p>
<p>thank you very much for the excellent example.<br>
Especially the comments in the file are very helpful.</p>
<p> </p>
<p>Best regards</p>