. Adding different row values in Birt Report
You are creating a BIRT report and getting the selection of data from SQL.
Total Status -------- --------- 6 Cancelled 3 Disputed 6 In Process 4 On Hold 4 Resolved 303 Shipped
You need to add Cancelled, Disputed and Resolved together and then divide the result with the total shipped. All of this should be done with an Expression. So x/303 where x is the sum of the desired values.
It’s not difficult to implement the requirement in Birt. You should use computed columns in your data set.
SUMon the column
Totaland a filter only matching the rows based on the column
Statusyou want to select. The expression should look like:
if (row["Status"] == "Cancelled" || row["Status"] == "Disputed" || row["Status"] == "Resolved") true else false
create a second computed column only containing the “Total” value where the Status is Shipped.
if (row["Status"] == "Shipped") row["Total"]
Then create a third computed column where you divide both computed values and you are done.
row["sum"] / row["shipped"]
Comparison of esProc implementation:
|1||=$select Total,Status from totalShipped|
The script will be clear at a glance. Especially when the data and calculation logic are more complicated, the advantages of using a simple script are more obvious, making report development and maintenance more efficient. For detail esProc integration with BIRT, see How to Call an SPL Script in BIRT.