Subreports and Variables

Posted on 2011-10-05
Last Modified: 2012-06-21
Hi Guys
I have been working on a report I like to call "subreport hell" at the moment.
Its a bit brutal and a little crude right now, but its almost doing exactly as designed

I am having trouble as I have a grid of subreports which are going away and extracting data for each historical year back to 2008 based on a value trn_cde.
The subreports all pass variables back to the main report for summing for each record.
Howver I am having trouble zeroing out the variables for the next record. Do subreports not run on a per record basis?
The first record is correct, but the subsequent records each have some values from the last record still being added up.

Can anybody offer advice. Its so close to be how I want it!

Screenshot shows all the subreports and the totals.
Its a bit ugly there are variables for each subreport passed back.
Question by:StratfrordDC
    LVL 100

    Expert Comment

    What section is it in?

    Subreports run everytime the section runs.

    If you need to 0 shared variables the best place might be in the subreport report header.
    You can also do it in a section before the subreport section but it has to be a section at the same level (group header, detail, etc)


    Author Comment

    The subreports are all split into their own details section

    What is happening is that even if the subreports  for the 2008 year go away and get nothing ( no values in the database ) the last time there was a variable value, it simply carries through those variable numbers. Distorting my results horribly.

    Each subreport line has its own details section. I have tried resetting the variables in details section a and all the subreports before they pick up a value.

    They are shared variables, but this is for summing purposes.

    Accepted Solution

    I just realised
    Its most crazy mistake.

    Where I was setting the variable to zero I was saying varLevy=0; instead of varLevy:=0; I was giving a boolen TRUE where i wanted to zero a variable!

    I just need to look at my report with a fresh pair of eyes
    thanks for your help mimcc.
    LVL 100

    Expert Comment

    This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    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…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    731 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

    15 Experts available now in Live!

    Get 1:1 Help Now