Subreport variable printing wrong in main report

Posted on 2004-10-21
Last Modified: 2012-08-13
I have a subreport which calculates a value. I set up the shared variable there and then use that to append values onto a total. The subreport is placed in a group header. I then create a formula in the main report to view that shared variable and place it in the same group section but just after the subreport yet it prints the value on the next group header. Does anyone know where I may be going wrong here?
Question by:TerraKeith
    LVL 28

    Accepted Solution

    Divide the the group header section into 2 sections.
    Right click the group header name in the left margin of the report and choose Insert Section Below.
    Move your formula that references the shared vairable into the lower section (group header section b) and leave the subreprt in the a section.
    Your formula should be correct now.
    LVL 42

    Expert Comment

    Brian is correct.  The reason for that is because you cannot reliably determine the order fields will be evaluated within a section.  Usually it works top to bottom but you can't depend on it.

    Section A will always be processed/evaluated before Section B so by splitting it you insure they're evaluated in the correct order.


    Author Comment

    The only problem with that is that I need to know the value of the variable returned so I can suppress the group section header and if so it's details section as well.
    LVL 28

    Expert Comment

    Does your subreport only calculate the variable to determine if you should suppress or not?

    The subreport has to run in order to calcualte the shared variable, so you can't suppress the section that contains the subreport.
    You can suppress group header a, the details, and group footer based upon the shared variable.

    If you subreport only present to calculate the value, then suppress all the sections in the subreport except one of the report footers.
    In the main report, make the subreport and the group header a section hieght as small as you can.  Also, right click the subreport, choose format, and under the comnon tab, make sure the can grow proprty is not set.

    Does this help at all?

    There are some more complicated alternatives that can be explored if need be.

    Author Comment

    Thanks for the help

    Author Comment

    It worked a charm

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Anonabox PRO Tor & VPN Router

    PRO is the most advanced way to fortify your privacy and online anonymity by layering the Tor network with VPN services. Use both together or separately, and without needing to download software onto your devices.

    Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
    Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
    With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
    This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

    913 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now