Reports for WinForms

Group summing and group headers after a page break

  •  targa72 said 10 months, 3 weeks ago:

    I’m having two problems using C1Reports with C1PrintPrviewControl, group summing and group headers after a page break. Everything is written in VB code. There are two groups with a single field that needs summing along with the report total. This should be easy but I just can’t get a handle on it.
    The other problem is when there is a page break within a group, the group header does not show on the next page just the detail until the next group is encountered.

  •  Mohita24p said 10 months, 3 weeks ago:

    Hello,

    In order to get show the total in fields you need to set the 'RunningSum’ property of the field. Set the property either to 'SumOverGroup’ or 'SumOverAll’ to get the desired sum value. You may also refer to the ’13: Subtotals and other Aggregates’ and ’17: Running Sums’ reports from CommonTasks for the implementation of the same.

    Regarding your second query, simply set the GroupHeader’s 'Repeat’ property to 'True’ and this will display the group header on the next page as well.

    Let us know if you still face any issues. Also, share with us the screenshot of the expected output and the report xml(along with the datasource).

    Regards,
    Mohita

  •  targa72 said 10 months, 2 weeks ago:

    Thank you for your prompt reply. The page break works fine but I’m still having problems with the sum. I’ve patterned my code after ComponentOne Reports for WinForms, Creating a report definition. Bellow is a portion from the Detail section. Then I add a field to the groupfooter1.

    f = .Fields.Add("FldAmount", "Amount", 8400, 5, 900, 200)
    f.Align = FieldAlignEnum.RightMiddle
    f.Format = " #,###.00″
    f.Calculated = True
    f.Font.Size = 10
    f.RunningSum = RunningSumEnum.SumOverGroup

    Then added this field to the groupfooter1.

    f = .Fields.Add("FldTotal", """ "" & Amount", 8400, 30, 900, 200)

    That gave the difference between the last two amounts in the group or if there was only one item then that amount.

    That ’13: Subtotals and other Aggregates’ you referred to, where can I find it? That is also mentioned Reports for WinForms with a hyperlink that takes you to samples but I can’t find it there.

  •  Mohita24p said 10 months, 2 weeks ago:

    Hello,

    The ’13: Subtotals and other Aggregates’ is one of the reports present in the CommonTasks.xml. It is the report definition file provided by C1 and can be found at the following location :
    C:UsersstduserDocumentsComponentOne SamplesStudio for WinFormsC1ReportC1ReportXMLCommonTasks

    Else, you may download the same from here. Note, that the datasource or the report is C1Nwind.mdb.

    Next, I am not very much clear with the issue mentioned by you regarding the difference shown in the values of the two sum fields. It would be really helpful if you could share your report xml(along with the datasource) with us.

    Regards,
    Mohita

    Attachments:
    You must be logged in to view attched files.
  •  targa72 said 10 months, 2 weeks ago:

    That, ’13: Subtotals and other Aggregates’, requires the use of the C1ReportDisigner. I’m not using an .XML report but coding it completely in VB.NET. Look at ComponentOne sample ‘CreateReport’ in VB.NET. I’ve added a numeric field to that style of a report, that’s where the group and report summing is needed (in VB.NET code). The current coding for the groupfooter gives the difference of the last two items in the column. If there are ten items in the column and the last two are 100 & 80 (in any order) the footer amount will be 20. If there is only one item in the column then the footer will show that amount.

  •  Mohita24p said 10 months, 2 weeks ago:

    Hello,

    As already mentioned by you that the group footer shows the difference of the last two items of the column. So this is the expected behavior that if the column has only one item, the same amount will get displayed in the footer.

    Could you please state the result, desired at your end. And clarify more on the problem faced by you. Also, it would quite helpful, if you can share the modified sample with us.

    Regards,
    Mohita

  •  targa72 said 10 months, 2 weeks ago:

    Please note I have been asking, from the beginning, for the SUM. The sum is the whole amount, total result of the column. The difference is the amount by which one quaintity is greater or less then the other. If you have a column of five numbers (15, 20, 10, 60, 90) the sum is 195, the difference is 30. What I want to see in the groupfooter is that 195 for that group and not 30 and due it in VB.NET.

  •  targa72 said 10 months, 2 weeks ago:

    I have attached three .pdf files.
    1. Crystal Reports is the type of report I’m trying to achieve, this was done in an earlier version of my program. 2. C1Report is the current report. As you can see the groups are not summing like they were in the Crystal Reports.
    3. frmReport code is the VB.NET code that is producing the current report.

    One of the reasons for the change is, with the Crystal report a separate file with 4 different reports was attach with the program. With the C1Report everything is done with code and no additional files.

    Attachments:
    You must be logged in to view attched files.
  •  targa72 said 10 months, 2 weeks ago:

    Found this on an old forum topic. It is easy just like I mention in the the first post.

    http://our.componentone.com/groups/winforms/reports-for-winforms/forum/topic/13441

    Answer
Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.