Folks!
I used expressions to sum some dataitems from a table and plugged it to a datagrid.
The summations work for all the data on the table. But unfortunately still reports the same aggregate results even after some relevant dataview filters had been applied.
Here's the code:
Dim dv As DataView
'create a dataview
dv = objBookings.browseBookings.DefaultView
'add required filter(s)
dv.RowFilter = "dEntryDate > #5/1/2007# AND dEntryDate < #5/30/2007#"
reportTab = dv.Table
Dim r As DataRow
r = reportTab.NewRow
r.Item("dFlightNo") = "Total Sales"
r.Item("dFare") = reportTab.Compute("Sum(dFare)", "")
r.Item("dAirlineCd") = reportTab.Compute("Count(dAirlineCd)", "")
r.Item("dFlightDate") = CDate("01/01/2007")
r.Item("dPassengerName") = ""
r.Item("dFromCity") = ""
r.Item("dToCity") = ""
r.Item("dBookingCd") = ""
r.Item("dSeatNo") = ""
r.Item("dEntryDate") = CDate("5/04/2007")
reportTab.Rows.Add(r)
dgDailySales.DataSource = reportTab
dgDailySales.DataBind()
I'll like the aggragation on the viewed data and not on the whole table.
Help would be appreciated.
I could easily do a spocs and effectively construct my 'where' clause but would not want to pursue that.