I´m trying to use together the GroupFormula and GroupCaption to sum the values of a column and count the children records of the group. The best I have is this, that I took from the forum :
Private Sub RCConsultasFinanceiro_BeforeDrawRow(ByVal Row As XtremeReportControl.IReportRow, ByVal Item As XtremeReportControl.IReportRecordItem, ByVal Metrics As XtremeReportControl.IReportRecordItemMetrics) Dim rcGroupRow As XtremeReportControl.ReportGroupRow If Not Row.groupRow Then If RCConsultasFinanceiro.Columns(Item.Index).Tag = "M" Then Metrics.Text = Format(Item.Caption, "R$ ##.00") End If Else Set rcGroupRow = Row Metrics.Text = rcGroupRow.GroupCaption & " (" & rcGroupRow.Childs.Count & ") " End If End Sub Private Sub RCConsultasFinanceiro_GroupOrderChangedEx(ByVal Column As XtremeReportControl.IReportColumn, ByVal Reason As XtremeReportControl.XTPReportColumnOrderChangedReason) Dim i As Integer Dim j As Integer Dim Row As ReportRow Dim groupRow As ReportGroupRow If Reason & xtpReportColumnAddedToGroupby Then For i = 0 To RCConsultasFinanceiro.Rows.Count - 1 Set Row = RCConsultasFinanceiro.Rows(i) If Row.groupRow Then sumSub = "" Set groupRow = Row For j = 0 To RCConsultasFinanceiro.Columns.Count - 1 If RCConsultasFinanceiro.Columns(j).Tag = "M" Then ''If numeric groupRow.GroupFormat = "%.02f" sumSub = sumSub & " SUMSUB(C" & j & ":C" & j + 1 & ")" End If Next groupRow.GroupFormula = sumSub End If Next End If RCConsultasFinanceiro.ReCalc True End Sub
|
the problem with this code is that the record count is shown together with the total column value instead with the group caption that is where I prefere I´m using vb6 activex 15.3.1 Thanks in advance for the help.
|