Resetting the Page Counter
The Page variable is created and automatically updated by the control. It is useful for adding page numbers to page headers or footers.
To reset the page counter when a group starts:
In some cases, you may want to reset the page counter when a group starts. For example, in a report that groups records by country and has a calculated page footer field with the expression:
=[Country] & " - Page " & [Page]
Using Code:
To reset the page counter when a group (for example, a new country) starts, set the PageFooter field's Text property. Enter the following code:
c1r.Fields("PageFooter").Text = "[Country] & "" "" & [Page]"
• C#
c1r.Fields("PageFooter").Text = "[Country] + "" "" + [Page]";
Using C1ReportDesigner:
To reset the page counter when a group (for example, a new country) starts, set the PageFooter field's Text property by completing the following steps:
1. Select the PageFooter's PageNumber field from the Properties window drop-down list in the Designer. This reveals the field's available properties.
2. Click the empty box next to the Text property, then click the drop-down arrow, and select Script Editor from the list.
3. In the VBScript Editor, simply type the following script in the window:
=[Country] & " - Page " & [Page]
To reset the Page variable for each new country:
It would be good to reset the Page variable for each new country. To do this, assign the following script to the Country Group Header section:
Page = 1
Using Code:
To reset the Page variable for each new country, set the Country Group Header OnPrint property. Enter the following code:
c1r.Sections("CountryGroupHeader").OnPrint = "Page = 1"
• C#
c1r.Sections("CountryGroupHeader").OnPrint = "Page = 1";
Using C1ReportDesigner:
To reset the Page variable for each new country, set the Country Group Header OnPrint property by completing the following steps:
1. Select the Country Group Header from the Properties window drop-down list in the Designer. This reveals the section's available properties.
2. Click the empty box next to the OnPrint property, then click the drop-down arrow, and select Script Editor from the list.
3. In the VBScript Editor, simply type the following script in the window:
Page = 1
|