Print Page | Close Window

GroupFormula and GroupCaption together

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=21629
Printed Date: 23 November 2024 at 7:54am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: GroupFormula and GroupCaption together
Posted By: mpereda
Subject: GroupFormula and GroupCaption together
Date 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.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net