Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

When is the formula "PageNumber" calculated in Crystal Reports?

All my report data is contained within a single section in Group Footer 3A, (with "Keep Together" ticked in the Section Expert) so that a single record will never be broken across a page break.

In Section Group Footer 3B I have empty space. In a printed report, this is space for handwritten comments. Because it is a separate section, the page break may occur between Section 3A and section 3B. In this case, I want to suppress Section 3B when it is at the top of a page.

In Group Footer 3A, I used a formula called setPreviousPageNumber to store the page number that section 3A is printed within:

      //setPreviousPageNumber
      Global Numbervar previousPageNumber := PageNumber;

* After the initial post, I also tried putting setPreviousPageNumber in the Page Footer Section

Then in Group Footer 3B I set a conditional suppression formula:

      //Conditional Suppression for Group Footer 3B
      previousPageNumber <> PageNumber;

My reasoning was that Section 3A would be on (for example) PageNumber 4, and if Section 3B was on PageNumber 5, then suppress it.

However I find my formula to setPreviousPageNumber in Section 3A results in a strange anomaly.

The formula in 3A sets the variable previousPageNumber to be (for example) 4.

When I use a formula to display the value of previousPageNumber in3B, it has mysteriously already incremented to 5.

      //printPreviousPageNumber
      WhilePrintingRecords;
      Global Numbervar previousPageNumber;

All these formulas are whileprintingrecords;

I have tried displaying both the PreviousPageNumber and the CurrentPageNumber in section 3B, and can see they are different. However, whenever I try to perform the comparison inside the Section Expert, I never get the result I want. Either the section is never suppressed, or it is always suppressed.

Does anyone have some insight on how I can suppress a section based on the page number of the previous section?

I'm using Crystal Reports 11.0.0.1282

Edited by: bradfisher on Feb 16, 2011 6:31 AM

Former Member
Not what you were looking for? View more on this topic or Ask a question