I drag a new created formula @Title under cross-tab's position, and there is a shared variable page_number (page_number := PageNumber) in the main report. In the beginning, I thought just need to retrieve the variable's value into @Title, so original structure in @Title as follows:
WhilePrintingRecords;Then, I encountered two problems:
Shared StringVar title_name;
Shared StringVar title_number;
Shared StringVar title_type;
Shared StringVar title_page;
Shared StringVar title_level;
Shared NumberVar figure_number;
Shared NumberVar page_number;
NumberVar page_number_sub;
Shared StringVar financial_flag;
figure_number := figure_number + 1;
page_number_sub := page_number;
title_number := title_number & 'Figure ' & TOTEXT(figure_number) & '.,';
title_name := title_name & 'Cross-Tab Name ' & {@@Machine_Code} & ' - ' & {usp;1.period} & financial_flag & ' (Part ' & TOTEXT({@@Page_Break}) & ' of ' & TOTEXT({@@Horizontal_Page_Number_Total}) & '),';
title_type := title_type & 'Figure,';
title_page := title_page & TOTEXT(page_number_sub) & ',';
title_level := title_level & '1,';
'Figure ' & TOTEXT(figure_number) & '. ' & 'Cross-Tab Name ' & {@@Machine_Code} & ' - ' & {usp;1.period} & financial_flag & ' (Part ' & TOTEXT({@@Page_Break}) & ' of ' & TOTEXT({@@Horizontal_Page_Number_Total}) & ')';
1. Sub-report doesn't capture correct page number, except the first page in sub-report, all the rest of pages display the same page number as the first page, for example, I place sub-report in the page 50 of main report, then every page's page number in sub-report displays 50.
2. If I execute sub-report in stand-alone status, only needs 1 minute to finish executing, if I execute it inside the main report, it takes really long time to finish running (almost 26 minutes = 1 minute * 26 pages), even I click Show Previous/Next Page or jump to specific page, it will automatically refresh for that page (another 1 minute).
After sacrificed couple of weekends in waiting and testing, finally find variable page_number is the major problem. The following is my fixed way:
1. Drag a new created formula @Page_Number_Prefix to the section before sub-report, suppress it and input script:
WhilePrintingRecords;2. Modify script of @Title in the sub-report:
Shared NumberVar page_number_prefix1;
page_number_prefix1 := PageNumber + 1;
Shared NumberVar page_number_prefix1;As you can see, the script of @Title is a bit different from SubRerpotForTitle_Figure.rpt, because I need to display like "Part Group_Page_Number of Group_Total_Pages" in each group's title, e.g. Part 1 of 4.
NumberVar page_number_sub;
Shared StringVar financial_flag;
figure_number := figure_number + 1;
page_number_sub := page_number_prefix1 + PageNumber - 1;
Next time, I will introduce how to design dynamic column number and position of cross-tab, and sub-total page number for each group.
No comments:
Post a Comment