Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - GroupFormula and GroupCaption together
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

GroupFormula and GroupCaption together

 Post Reply Post Reply
Author
Message
mpereda View Drop Down
Newbie
Newbie


Joined: 22 April 2013
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote mpereda Quote  Post ReplyReply Direct Link To This Post Topic: GroupFormula and GroupCaption together
    Posted: 05 May 2013 at 9:05pm
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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.125 seconds.