This document will keep track of some of the patterns and solutions we have developed for scripting report calculations.
"Summary of Summaries" - Using an Array List to Sum One Instance of a Value Only Once. | |
Some fields in the report data sets do not represent a period value- they represent the grand total to date, or for the entire period. For one situation, we needed to create a report that got the grand total for the flock, using the expense summary dataset. The FC_LbsFeedConsumed_LTD field
| Dim total as Decimal Dim housecodes as ArrayList = new ArrayList() Private Sub label34_SummaryRowChanged(ByVal sender As Object,ByVal e As System.EventArgs) Dim id as integer= GetCurrentColumnValue("General_HouseID") if housecodes.Contains(id) then return Dim amount as decimal = GetCurrentColumnValue("FC_LbsFeedConsumed_LTD") total += amount housecodes.add(id) End Sub Private Sub label34_SummaryReset(ByVal sender As Object, ByVal e As System.EventArgs) total = 0 housecodes = new ArrayList() End Sub Private Sub label34_SummaryGetResult(ByVal sender As Object, ByVal e As DevExpress.XtraReports.UI.SummaryGetResultEventArgs) e.result = total e.handled = true End Sub |