This is a migrated thread and some comments may be shown as answers.

Subtotal a field that occurs in a group total

3 Answers 179 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Doug
Top achievements
Rank 2
Doug asked on 24 Feb 2013, 04:38 PM
I have a report  that is using Q1 2013 (6.2.13.110).  This is a WINFORMS application written in VB.NET 2010

I have 3 group sections on the report where group 2 ("CltName") has a few summary fields as well as a Last(xxx) field (lets call it "GroupEndBalance".  I would like to create a summary field for "GroupEndBalance" in the "CltMasterNameGroup" but reporting will not allow a Sum(Last(xxx)) or a Sum(GroupEndBalance).

How can I get a summary of the "GroupEndBalance" field into the "CltMasterNameGroup".

I think if I was able to create a global variable and store the sum of this value on group2 change that may work but I am unsure as to how to accomplish that.

I have attached a screen shot of what the design of the report is so you can get an idea of what it looks like.

Any detailed ideas would be helpful.

Doug

3 Answers, 1 is accepted

Sort by
0
Doug
Top achievements
Rank 2
answered on 25 Feb 2013, 04:26 AM
I was able to come up with a solution to my problem.  Hopefully this was the correct way to make what I wanted to happen happen.

Inherits Telerik.Reporting.Report
Dim gBegBal As Double
Dim gEndBal As Double
 
Public Sub New()
    InitializeComponent()
    gBegBal = 0
    gEndBal = 0
End Sub
 
Private Sub TextBox26_ItemDataBinding(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox26.ItemDataBinding
    Dim txt As Telerik.Reporting.Processing.TextBox = DirectCast(sender, Telerik.Reporting.Processing.TextBox)
    Dim dataObject As Telerik.Reporting.Processing.IDataObject = DirectCast(txt.DataObject, Telerik.Reporting.Processing.IDataObject)
    gBegBal = gBegBal + DirectCast(dataObject("BegBal"), Decimal)
End Sub
 
Private Sub uiGroupBegBal_ItemDataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles uiGroupBegBal.ItemDataBound
    Dim txt As Telerik.Reporting.Processing.TextBox = DirectCast(sender, Telerik.Reporting.Processing.TextBox)
    txt.Value = gBegBal
    gBegBal = 0
End Sub
 
 
Private Sub uiGroupEndingBal_ItemDataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles uiGroupEndingBal.ItemDataBound
    Dim txt As Telerik.Reporting.Processing.TextBox = DirectCast(sender, Telerik.Reporting.Processing.TextBox)
    txt.Value = gEndBal
    gEndBal = 0
End Sub
 
 
Private Sub cltNameGroupFooter_ItemDataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles cltNameGroupFooter.ItemDataBound
    Dim gTextBox3 As Decimal = 0
    Dim section As Processing.GroupSection = DirectCast(sender, Processing.GroupSection)
    gTextBox3 = Convert.ToDecimal(DirectCast(Processing.ElementTreeHelper.GetChildByName(section, "TextBox3"), Telerik.Reporting.Processing.TextBox).Value)
    gEndBal = gEndBal + gTextBox3
End Sub
0
Jon
Top achievements
Rank 1
answered on 25 Feb 2013, 12:53 PM
Funny timing, your issue is more or less the same as one I was having and I'd thought up a similar fudge to resolve.  Hopefully someone at telerik can suggest a built in mechanism for this!
0
Stef
Telerik team
answered on 28 Feb 2013, 11:45 AM
Hello everyone,

Please note that this solution depends on the order in of the items in the report. If for some reason items change positions in the ReportItemBase.Items collection the events will appear in different order and the logic will fail.

It is not very clear from the screenshots what is the scenario and which TextBox items values are meant to be summed, but proper data structure with or without applied data function for a given scope should get the desired values.

If you send us more details about your scenario or even better a whole runnable sample project in a support ticket or via link to a shared document, it would be help us to provide you with more accurate suggestions.

Kind regards,
Stef
the Telerik team

See what's new in Telerik Reporting Q1 2013. Register for the March 4 webinar to witness the impressive new visualizations in Telerik Reporting. Just for fun, 10 webinar attendees will be randomly selected to win a Telerik T-shirt and a $50 Gift Certificate to ThinkGeek. Register now! Seats are limited!

Tags
General Discussions
Asked by
Doug
Top achievements
Rank 2
Answers by
Doug
Top achievements
Rank 2
Jon
Top achievements
Rank 1
Stef
Telerik team
Share this question
or