esProc Assists BIRT in Handling Intragroup Inter-row Calculations

Uncategorized 1060 0

Problem source:

http://developer.actuate.com/community/forum/index.php?/topic/36160-dealing-with-previous-rows-groups-sorts-and-subtotals/ . 

Generally intragroup inter-row calculations are handled with window functions or report scripts. But the code is rather complicated. Instead, you can use esProc to assist reporting tools in dealing with them. Below is such an example. 

Database table sample has three fields, among which id is the grouping field. You need to design a grouped table where id is the grouping field and the other fields holding detail data include v1, v2 and the computed field crossline. crossline will be calculated like this: v1+v2+previous v1+previous v2. Below is the original data:

esProc_report_birt_interrow_1

esProc code for data preparation:

        

A

1

=myDB1.query(“select *,0 as crossline from sample”)

2

>A1 group(id).run(~.run(v1+v2+v1[-1]+v2[-1]:crossline))

3

result A2

A1: Query the database and create an additional field with constant values for later use.

A2: Group A1 by id, modify crossline values for each group and combine groups of data together. Result is as follows:

esProc_report_birt_interrow_3

A3: Return A2’s result to the reporting tool. esProc provides JDBC interface outward to be identified by a reporting tool as a normal database. 

FAVOR (0)
Leave a Reply
Cancel
Icon

Hi,You need to fill in the Username and Email!

  • Username (*)
  • Email (*)
  • Website