Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

running total/summary on shared variable from subreport

Status
Not open for further replies.

suburbanites

Programmer
Aug 16, 2007
75
US
I am using CRXI SP1.

I have my variables from the subreport showing in the main report. My problem now is summing up/creating a running total on the amount depending on the grouping(I have 5 so far). Do I need to create another variable in the subreport with the same grouping as in the main report and bring it back that way?

Any help will be greatly appreciated.
 
In your main report you will need to create new vars for each group and reset in relevant group header.


Group1 header

@reset
whileprintingrecords;
global numbervar group1:=0

Wherever shared numbervar passed

@eval
whileprintingrecords;
shared numbervar s1;
global numbervar group1;

group1:=group1+s1

Group footer
@display
whileprintingrecords;
global numbervar group1

Ian
 
Thanks for the reply Ian. I was able to sum up the details amount and it shows on the lowest drill down group level. However, when I close the tab and go to the next group level, the same group footer total and was previously sowing now shows as 0. What happened to the total amount? It's still on the same group footer but now shows as 0 when I close the drill down tab.
 
Sorry not sure what impact of using drill downs is on such var totals. Sounds like its not being evaulated properly in the drilldown process.

Try displaying the var as it totals and check its is incrementing correctly.

Whn using drill downs is the subreport evaluating correctly?

Ian
 
Only at the lowest drill down level. Could it be because my subreport with the amounts is in the lowest drill down group? should I create another subreport for each group?
 
Sounds like that is the problem.

In that case evaluate your higher group totals at the lowest group level, ie as I said in earlier post.

Wherever shared numbervar passed, place this formula

@eval
whileprintingrecords;
shared numbervar s1;
global numbervar group1;

group1:=group1+s1

Ian
 
Still not working. Maybe I'm doing it wrong.

In my GH6, I have the subreport. In GF5 I have defined the following:
whileprintingrecords;
shared numbervar s1;
global numbervar stot1;
stot1 := stot1 + s1;
s1

I then place this variable in GF6 and it works. It shows the correct amount from the subreport for each record. Then I have another variable subtot1 which has the following:
whileprintingrecords;
global numbervar stot1;
stot1

I then place this on GF5 and it does show the total of the individual records from above. When I go to close on this drill down tab, subtot1 is now zero at the next level.

I don't have a reset for subtot1 so I am not understanding why it would be zero just because I am on the next level.


 
This is how it looks like:

GH6
travel1 2000
travel2 3000
travel3 1000
GF5 total travel 6000
salary1 200
salary2 300
salary3 100
GF5 total salary 600

GH4
GF5 total travel 0
GF5 total salary 0
GF4 total account 0

It's the same GF5 but I just went to next level. Now the amounts 6000 and 600 are both 0. They should still have the same value as when I was in the lower level


 
Which variable is displaying

6000 and 600.

In order for this to change it must have a reset somewhere.

To hide this
GH6
travel1 2000
travel2 3000
travel3 1000
Are you hiding or suppressing, if you use Supress vars and subreports will not evalauate, you must use hide.

Ian
 
both 6000 and 600 are displaying perfectly on the lowest drill down. However, it zeroes out on the next level drill down even though it's stil on GF5. I am suppressing for sections that needs to ne suppresed. GH5 which contains the subreport is hidden not suppressed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top