Passing shared variables based on group totals in sub report to main report
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Passing shared variables based on group totals in sub report to main report

Hybrid View

  1. #1
    Join Date
    Aug 2013
    Posts
    1

    Passing shared variables based on group totals in sub report to main report

    Hi,

    I am passing parameters from the main report (run as of date & item code range, category code range) to sub report
    and then need to pass back shared variables based on group totals from the sub report to the main report.
    I have setup formula in the main report calling the shared variables from the sub-report, however the totals from the sub report are not calculating & passing through properly.

    The values of the last record in the sub report are passing to the main report, not the group totals or the grand total.

    On the main report, the sub report is placed in the section above shared variable formula.

    In the sub-report I have 3 group totals.

    • Item - This is the sub report being place on the main report.
    • Category Have setup shared variables for these, placing in a group below the sub report
    • Grand totals. Have setup shared variables for these, placing in the report footer in the main rpeort


    Could someone please let me know why the shared variables from the sub report are only printing the values of the last record in that group instead of the group totals?

    Is it possible to pass multiple group totals from a sub report into a main report via shared variables?

    Report is like this

    Main report


    • Group footer #3 Item code <Sub report group footer 2 of Item totals> <other fields>
    • Group footer #2 (other sort)
    • Group footer #1 Category totals <@vCatSalesAmt>
    • Report Footer (Grand totals) <@vGTSalesAmt>



    Sub report: Sales file sorts category, then item code

    • Detail (Suppressed): <Item Code> <Month> <Qty> <Amount>
    • Group Footer 2 Item totals <Qty, Item> <Amount, Item> (sub report placed on main report)
    • Group Footer 1 Category totals (hidden) <Qty, Item> <Amount, Item>
    • Report Footer Grand total (hidden) <Qty, Item> <Amount, Item>



    For Category totals I created formula in the sub-report like this:
    //@vCatSalesAmt>
    WhilePrintingRecords;
    shared CurrencyVar CatSalesAmtYTD := Sum ({@Sales Amount YTD}, {ICITEM.CATEGORY});


    For grand totals I created a formula in the sub-report to set the variables.
    //<@vGTSalesAmt>
    WhilePrintingRecords;
    shared CurrencyVar GTSalesAmtYTD := Sum ({@Sales Amount YTD});
    Attached Files Attached Files

  2. #2
    Join Date
    Jul 2005
    Posts
    1,074

    Re: Passing shared variables based on group totals in sub report to main report

    Could You attach just the rpt?
    I can't download your actual attachment (my antivirus says nop)
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center