Print Page | Close Window

ReportControl SUBSUM

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


Topic: ReportControl SUBSUM
Posted By: axdoverm
Subject: ReportControl SUBSUM
Date Posted: 02 August 2010 at 7:00am
Hey Guys,

I hope somebody can help me. If you look in the image below you will see that a have a SUBFORMULA in the reportcontrol with a result in the grouprow (nr. 1)


the SUM is now calculating the kolom (nr. 2) and that works, but i would like to get the SUM result from the last colomn in the report (nr. 3). Too calculate the SUM i use the following code: (i found this code on this forum and addepted to my needs)


CODE EXAMPLE:
Public Sub RapportageOmzetPerKlant(sSQL As Variant)
 '
 On Error GoTo HELL
 '
 Dim Column As ReportColumn
 Dim Record As ReportRecord
 Dim Item As ReportRecordItem
 Dim row As ReportRow
 Dim groupRow As ReportGroupRow
 '
 frmMAIN.ReportControl1.Columns.DeleteAll
 frmMAIN.ReportControl1.Records.DeleteAll
 '
 Set Column = frmMAIN.ReportControl1.Columns.Add(0, "Datum", 100, True)
      Column.Visible = True
 Set Column = frmMAIN.ReportControl1.Columns.Add(1, "Factuur", 80, True)
      Column.Visible = True
 Set Column = frmMAIN.ReportControl1.Columns.Add(2, "Aantal", 70, True)
      Column.Visible = True
 Set Column = frmMAIN.ReportControl1.Columns.Add(3, "Omschrijving", 220, True)
      Column.Visible = True
 Set Column = frmMAIN.ReportControl1.Columns.Add(4, "St. Prijs", 90, True)
      Column.Visible = True
 Set Column = frmMAIN.ReportControl1.Columns.Add(5, "Totaal", 100, True)
      Column.Visible = True
 Set Column = frmMAIN.ReportControl1.Columns.Add(6, "KLANT", 0, True)
      Column.Visible = False
      '
   If CNN_DB.state = 1 Then CLOSE_DB_CONNECTION
      '
      OPEN_DB_CONNECTION (sSQL)
        '
        Do Until RST_DB.EOF = True
          '
          Set Record = frmMAIN.ReportControl1.Records.Add()
          Set Item = Record.AddItem(RST_DB.Fields("DATUM") & "")
          Set Item = Record.AddItem(RST_DB.Fields("FACT_NO") & "")
          Set Item = Record.AddItem(RST_DB.Fields("AANTAL") & "")
          Set Item = Record.AddItem(RST_DB.Fields("OMSCHRIJVING") & "")
          Set Item = Record.AddItem(FormatNumber(RST_DB.Fields("ST_PRIJS"), 2) & "")
          Set Item = Record.AddItem(FormatNumber(RST_DB.Fields("REGEL_TOT_INC"), 2) & "")
          Set Item = Record.AddItem(RST_DB.Fields("KLANT") & "")
          '
        RST_DB.MoveNext
        '
      Loop
      '
   If CNN_DB.state = 1 Then CLOSE_DB_CONNECTION
   '
   frmMAIN.ReportControl1.GroupsOrder.Add frmMAIN.ReportControl1.Columns(6)
   frmMAIN.ReportControl1.Populate
   '
   For i = 0 To frmMAIN.ReportControl1.Rows.count - 1
        Set row = frmMAIN.ReportControl1.Rows(i)
        If row.groupRow Then
           Set groupRow = row
           groupRow.GroupFormat = " [Omzet =%.02f]"
           groupRow.GroupFormula = "SUMSUB(C2:C3)"
           groupRow.GroupCaption = "x"
        End If
   Next
   '
   Exit Sub
   '
HELL:
   '
   If CNN_DB.state = 1 Then CLOSE_DB_CONNECTION
   ErrorHandler Err.Number, Err.Description, "modRAPPORTAGE", "RapportageOmzetPerKlant()"
   '

End Sub

If i change the SUMSUB to (F2:F3) i don't get any results, what i'm missing ?? ... i cant figure is out! ... so please HELP ME!



-------------
Product: Xtreme SuitePro (ActiveX) version 11.2.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0



Replies:
Posted By: markmark
Date Posted: 05 August 2010 at 4:45am

Hi

 

I think you need it to be SUMSUB(C6:C7)

 

The "C" is not Col C

 

But I still have problems with this as well, as I cannot get it to calculate for a single row.

 

Please see my test app, where you can enter your formula.

 

Would like to see examples of a single row calculation.

 

Also Why in the above does it calucalte just Col 6 and not col6 and col7?

 

Mark

 
http://forum.codejock.com/uploads/20100805_044440_example.zip - uploads/20100805_044440_example.zip


-------------
Product: Xtreme SuitePro (ActiveX) version 13.0.0
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0


Posted By: Aaron
Date Posted: 07 August 2010 at 4:40am
Originally posted by axdoverm axdoverm wrote:

Hey Guys,
 
[...]
If i change the SUMSUB to (F2:F3) i don't get any results, what i'm missing ?? ... i cant figure is out! ... so please HELP ME!
[...]

 
Hi,
 
You need SUMSUB(R*C5:R*C6) for calculating "Omzet"
 
 
From:
R     =     Row
*     =     Rownumber (* means all rows)
C     =     Column
5     =     Column number (=ItemIndex)
 
To:
R     =     Row
*     =     Rownumber (* means all rows)
C     =     Column
6     =     Column number (=ItemIndex)
 
 
 
 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....



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