Print Page | Close Window

Report with Formulas

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=13976
Printed Date: 04 May 2024 at 1:14am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Report with Formulas
Posted By: mdoubson
Subject: Report with Formulas
Date Posted: 10 April 2009 at 2:00pm
I added Formula support to ReportRecordItem. If presented - Item Caption will show result of calculations based on given Formula.
 
Examples -
 
SUM(R2C3:R8C4) - given range
SUM(R*C3:R*C4) - means all rows (parent rows only in case of hierarhy)
SUM(R2C*:R8C*) - means all columns
SUM(R*C*:R*C*) - means all
given item always excluded from the loop - no circular refs
 
similar for child records
SUMSUB(R2C3:R8C4) - given range for childs
SUMSUB(R*C3:R*C4) - means all childs rows
SUMSUB(R2C*:R8C*) - means all columns
SUMSUB(R*C*:R*C*) - means all
 
so parent item chan show subtotal
and bottom item can show total by all
 
 
It also works in VB
 
If user is doing data entry run-time in interactive way - he need to press F5 to call Recalc in the end and will see results
 


-------------
Mark Doubson, Ph.D.



Replies:
Posted By: mdoubson
Date Posted: 13 August 2009 at 10:39pm
Now Report also supported dynamic formulas in Group Rows (good for subtotlals by different criteria) - https://forum.codejock.com/forum_posts.asp?TID=14968&KW=Formula - https://forum.codejock.com/forum_posts.asp?TID=14968&KW=Formula

-------------
Mark Doubson, Ph.D.


Posted By: mdoubson
Date Posted: 14 August 2009 at 8:41pm

Added Cascade Group Row formula support - http://forum.codejock.com/forum_posts.asp?TID=14837&PN=1 - http://forum.codejock.com/forum_posts.asp?TID=14837&PN=1  (SubTotal by internal SubTotals)



-------------
Mark Doubson, Ph.D.


Posted By: mdoubson
Date Posted: 02 January 2010 at 12:26pm
Added multiple subtotals in group rows with dynamic formula - you can try it in action in https://forum.codejock.com/uploads/BetaOCX/ReportControlBeta13-2-2.rar - https://forum.codejock.com/uploads/BetaOCX/ReportControlBeta13-2-2.rar  where are VB6 sample - you can use same idea and make simple MFC sample with same feature using https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar - https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar

-------------
Mark Doubson, Ph.D.


Posted By: mdoubson
Date Posted: 04 January 2010 at 3:56pm
see snapshot of new feature - https://support.codejock.com/Attachments/20091228-140707_GroupRowsWithMultipleSubtotals.jpg - https://support.codejock.com/Attachments/20091228-140707_GroupRowsWithMultipleSubtotals.jpg

-------------
Mark Doubson, Ph.D.


Posted By: Algae
Date Posted: 05 January 2010 at 9:12pm
Looks pretty interesting and useful. If there was a group "footer" totals could display on the end of group line so you could do sub-reports.

something like:

Group Header
-------
Item 1,1  Item 1,2    Item 1.3
Item 2.1  Item 2.2    Item 2.3
.... etc
______
Group Footer Total         Total


Posted By: znakeeye
Date Posted: 06 January 2010 at 8:18pm
Though this is a nice add-on, I still think this kind of functionality belongs in a separate Grid-control. You will most likely end up having to refactor this code later on... :(

-------------
PokerMemento - http://www.pokermemento.com/


Posted By: blackeagle
Date Posted: 11 February 2010 at 12:48pm
Hi
Is it possible to print grouprow item's count with formula at group caption?
 
 


-------------
eagles fly higher...


Posted By: davidbeane
Date Posted: 08 June 2010 at 4:09pm
Could you possibly give a sample of the code used to insert the records into the control as in the screenshot displayed?
(The original screenshot in the first post)

Not the formulas, just how to insert the grouped rows.

I cannot figure out how to insert data in a hierarchical format like that.


Posted By: davidbeane
Date Posted: 09 June 2010 at 2:12pm
I finally discovered CXTPReportColumn::SetTreeColumn()


Posted By: jequita2009
Date Posted: 02 September 2010 at 1:49pm
''establishing the following function to generate a string:

Private Function SumSub() As String
    Dim SumSubf As String
    Dim cadena As String
    cadena = " "
    
    For x = 0 To RC.Columns.Count - 1
        RC.Columns(x).Tag = G_Header(1, x)
        If RC.Columns(x).Tag = "N" Then
           SumSubf = "SUMSUB(C" & x & ":C" & x + 1 & ")"
           cadena = cadena + SumSubf
        End If
    Next
    
    SumSub = cadena
    
End Function



Posted By: jequita2009
Date Posted: 02 September 2010 at 1:50pm
''Espero que les sirva
''Esto es en caso no se sabe que columna es numérica o no.
''I hope you learn
''This is in case you do not know which column is numeric or not.


Private Sub RC_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
    Dim xRecord As XtremeReportControl.ReportRecord
    Dim xRecordItem As XtremeReportControl.ReportRecordItem
   
    Dim CadenaSumSub As String
    CadenaSumSub = SumSub
   
    If Reason & xtpReportColumnAddedToGroupby Then
     
        For j = 0 To RC.Columns.Count - 1
            If RC.Columns(j).Tag = "N" Then   ''If numeric
                For i = 0 To RC.Rows.Count - 1
                    Set Row = RC.Rows(i)
                    If Row.groupRow Then
                        Set groupRow = Row
                            'sumSub = "SUMSUB(C" & j + 1 & ":C" & j + 1 + 1 & ")"
                            groupRow.GroupFormat = " Subtotal =%.02f"
                            groupRow.GroupFormula = CadenaSumSub
                            groupRow.GroupCaption = "x"
                      
                    End If
                Next
            End If
        Next
       
    End If

End Sub
 


Posted By: Ajit
Date Posted: 14 September 2010 at 1:07pm
Hi

      Can somebody help me to display total in group rows. as shown in following screenshot.



available example in this forum is in VB. what will be the equivalent code in VC++.

Thanx in advance.



Posted By: RJAMIN
Date Posted: 05 October 2010 at 4:32pm
You can just put the item count in the caption. Example:
 
Private Sub wndReportControl_GroupOrderChangedEx(ByVal sender As Object, ByVal e As AxXtremeReportControl._DReportControlEvents_GroupOrderChangedExEvent) Handles wndReportControl.GroupOrderChangedEx
    Dim row As Integer
    Dim sumSub As String
    Dim groupRow As XtremeReportControl.ReportGroupRow
    If ((e.reason And XTPReportColumnOrderChangedReason.xtpReportColumnAddedToGroupby) = XTPReportColumnOrderChangedReason.xtpReportColumnAddedToGroupby) Or _
       ((e.reason And XTPReportColumnOrderChangedReason.xtpReportColumnRemovedFromGroupby) = XTPReportColumnOrderChangedReason.xtpReportColumnRemovedFromGroupby) Then
        sumSub = "SUMSUB(C6:C7)"
        For row = 0 To (wndReportControl.Rows.Count - 1)
            If (wndReportControl.Rows(row).GroupRow) Then
                groupRow = wndReportControl.Rows(row)
                groupRow.GroupFormula = sumSub
                groupRow.GroupFormat = "%0.2f"
                groupRow.GroupCaption = (" (" + groupRow.Childs().Count.ToString() + " items)")
            End If
        Next
    End If
End Sub



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