Hi guys!
Crystal Reports 10.
I'm trying to update a shared variable in a subreport and display it in the main report. I'm a bit puzzled.
What I'm doing is this: In the Page Header of the main report, I'm setting the variable to 0. My main report contains a group, and on the group footer, I have the subreport. The subreport itself contains a group, and in that group footer, I'm updating the shared variable. Now on the page footer of the main report, I want to display the variable, but it's not showing up as I expect it.
Here's how the whole thing looks, assuming that x is the shared variable (SR = subreport):
[tt]Main Report
Page Header >> x := 0;
Group1 Header
Group1 Footer (Subreport is here)
SR:Group1 Header
SR:Group1 Footer >> x := x + 1;
Page Footer >> (display x)[/tt]
Let me explain a bit more.
The subreport
The subreport displayes a list of users. The group in the subreport groups records by a user field in the database, and thus, each value in the footer of the group will be a different user. Right on this footer, I have a formula which increments the shared variable by 1. Each user is printed on a different row, and there is a total of 37 users, 29 of which fit on the first page. The rest are displayed on a second page.
The main report
The main report groups records by month (based on a date field) and it doesn't see any users. The subreport is in the group footer. For every month, the entire list of users is printed (i.e. the subreport is displayed). Thus for every different group (month) value in the main report, the subreport prints two pages (29 users on the first page, 8 on the second).
The Problem
With the setup above, the x shared variable is coming up as 0 on the first page, even though it should be 29. For every page after the first one, x is coming up as 37.
I'm expecting x to be 29 on the first page of every month, and 37 on the second page of every month. Am I missing something?
Thanks.
JC
_________________________________________________
To get the best response to a question, read faq222-2244.
Crystal Reports 10.
I'm trying to update a shared variable in a subreport and display it in the main report. I'm a bit puzzled.
What I'm doing is this: In the Page Header of the main report, I'm setting the variable to 0. My main report contains a group, and on the group footer, I have the subreport. The subreport itself contains a group, and in that group footer, I'm updating the shared variable. Now on the page footer of the main report, I want to display the variable, but it's not showing up as I expect it.
Here's how the whole thing looks, assuming that x is the shared variable (SR = subreport):
[tt]Main Report
Page Header >> x := 0;
Group1 Header
Group1 Footer (Subreport is here)
SR:Group1 Header
SR:Group1 Footer >> x := x + 1;
Page Footer >> (display x)[/tt]
Let me explain a bit more.
The subreport
The subreport displayes a list of users. The group in the subreport groups records by a user field in the database, and thus, each value in the footer of the group will be a different user. Right on this footer, I have a formula which increments the shared variable by 1. Each user is printed on a different row, and there is a total of 37 users, 29 of which fit on the first page. The rest are displayed on a second page.
The main report
The main report groups records by month (based on a date field) and it doesn't see any users. The subreport is in the group footer. For every month, the entire list of users is printed (i.e. the subreport is displayed). Thus for every different group (month) value in the main report, the subreport prints two pages (29 users on the first page, 8 on the second).
The Problem
With the setup above, the x shared variable is coming up as 0 on the first page, even though it should be 29. For every page after the first one, x is coming up as 37.
I'm expecting x to be 29 on the first page of every month, and 37 on the second page of every month. Am I missing something?
Thanks.
JC
_________________________________________________
To get the best response to a question, read faq222-2244.