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!

Passing Page number from main report to subreport

Status
Not open for further replies.

oanion

IS-IT--Management
Jun 18, 2004
55
Hello All.

I have a report that contains 1 subreport.

The main report is grouped by timezone with all details showing. The timezone group footer contains information for the specific time zone such as:
number of customers, number of accounts, amount owed, and amount collected.

The subreport has the same information, however, I've suppressed the details to only show the timezone grouping summarized information pertaining to the information mentioned above.

In the subreport, I want to show the page number in the main report where the timezone group starts which will make it easier for the user to locate where to find the detailed rows.

For instance, if the central timezone group starts on page 14 in the main report, the subreport should show the following;

# of customers # of accounts $$ Owed $ collected page number


20 36 $36000 $12500 14




Does anyone have an idea of how to accomplish this? I first started by trying to capture a page number in a shared varaible in the main report and pass it to the subreport, however, this does not work? Any advice will be more than appreciated.

Thanks
 
In what report section is the subreport located? Is it linked to the main report? If so, how?

-LB
 
The subrport is located in the report header and is linked to the main report by an office parameter name which are ENDICOTT and MARIETTA.
 
You cannot shared variables "up" to a higher report section. You could only pass them down to a subreport in the report footer.

-LB
 
Ok. So I should move the subreport into the report footer? And if so, how would I pass the page numbers from the main report with details to the subreport with the timezone groupings?
 
You would have to basically save the same report as your subreport, showing only the summary information for the groups. Then you would have to set up an array variable in your main report to pass the page numbers to the subreport in the report footer.

-LB
 
By any chance do you have an example of an array variable. I've never had to work with one of those? Or could you direct me so a website that would be able to explain how this would be accomplished.
 
In the main report, create the following formula and place it in the time zone group footer:

whileprintingrecords;
shared numbervar array pageno;
shared stringvar array tzone;
shared numbervar i;
shared numbervar j := 1000;

if i < j then(
if onfirstrecord or
{table.timezone} <> previous({table.timezone}) then (
i := i + 1;
redim preserve timezone[j];
redim preserve pageno[j];
tzone := {table.timezone};
pageno := pagenumber
));

In the subreport, add this formula to the timezone group footer:

whileprintingrecords;
shared numbervar array pageno;
shared stringvar array tzone;
shared numbervar i;
shared numbervar j := 1000;
numbervar x;

for i := 1 to j do(
if {table.timezone} = tzone then
x := pageno
);
x

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top