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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Page of subreport in main report (Urgent)

Status
Not open for further replies.

manjyo

Programmer
Jul 2, 2003
15
IN
hi
I am having one main report and a subreport in the detail setion of it. i want to print the total number of records from the sub report in the page footer section of the main report. I created a shared variable and then assigned the total number of records in the sub report. when I am printing that variable in the page footer section of the main report, in the first page it is showing as zero (initial value of the shared variable) and from the second page onwards it is showing the correct value. I want it in the first page itself. I am using CR Ver. 9

Thanks in advance

Manoj
 
This is probably because the subreport is more than one page, so that the count is not fully calculated until page 2 (When I tried a subreport that fully executed on one page, the shared variable in the page footer did work). The solution is to add a copy of the subreport to the report header. You can suppress all sections within the subreport, revmove the borders, and make the subreport as narrow as possible. If the subreport in the details section moves to the next page, go to format subreport and uncheck "Keep object together". The page footer shared variable should now appear on page 1.

-LB
 
Hi,
Thanks for your advise. Here subreport contains 31 pages. I inserted the supreport in the report header section and unchecked the keep group together option. Now the shared variable prints the value 1 instead of 31. Can you advise?

Thanks in advance

Manoj N.

 
Not sure how you got that. I'm assuming the subreport in the report header is an exact copy of the subreport in the details section, and that when you look at the report footer in the RH subreport, it shows a count of 31 (I'm assuming you meant you had 31 records, not 31 pages), and that you have set this equal to the shared variable in the RH subreport. While you can suppress every section within the subreport, the report header itself cannot be suppressed.

What is your shared variable formula? It should be something like:

whileprintingrecords;
shared numbervar x := count({table.field});

If you have different formula, please share the contents.

-LB
 
Hi
Thanks for ur suggesstion. 31 is the page count of the subreport. It is not the record count. I am declaring the shared variable in the main report. Then in the sub report I am assiging the page count by the formula

whileprintingrecords;
shared numbervar x := TotalPageCount

Then i am printing the shared variable in the pagefooter section of the main report. But it is showing 1 instead of 31. Its is showing the correct count from the 2nd page onwards.

where i am going wrong?

Please advise.

Regards

Manoj

 
Not sure if you have this option, but you might try formatting the main report detail section to "New Page After" and also "Reset Page Number After". Place the special field "totalpagecount" in the page footer of the main report. This would give you the number of pages of the subreport each time it is printed, i.e., whenever a new detail is printed. In other words, let the main report display the totalpagecount, not the subreport.

The subreport in the report header won't work, since the totalpagecount will always be one with all sections suppressed.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top