• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 280
  • Last Modified:

Subreports and Variables

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.
  • 2
  • 2
1 Solution
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)

StratfrordDCAuthor Commented:
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.
StratfrordDCAuthor Commented:
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.
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now