Heinnge
Heinnge

Reputation: 858

Number of details records on the crystal report page

i would like to find out the number of details records on the last page of the crystal report, and if there is none, I would like to hide the header section.

Upvotes: 2

Views: 12939

Answers (4)

Disha Patil
Disha Patil

Reputation: 1

Just using "OnLastRecord" in the Supress formula for PageHeader will solve the purpose.

Upvotes: -1

user1051439
user1051439

Reputation:

First, you have to create a formula. Then, insert it into to the Details section. For example @VariableA

Inside the formula, put this:

Shared NumberVar PageofLastField;
If OnLastRecord then PageofLastField := PageNumber;

Suppress formula.

The formula checks if the record is the last record. If it is the last record, it saves the Page Number where the last record is to the shared variable PageofLastField.
Then on the Suppress formula of your header, put this code:

Shared NumberVar PageofLastField;
PageofLastField := PageofLastField;
if pageofLastfield <> 0 and PageNumber > PageofLastField
    THEN TRUE
ELSE FALSE

Upvotes: 2

PowerUser
PowerUser

Reputation: 11791

Suppressing the header based on a formula result is easy. The hard part is counting the number of details sections that appear on a specific page.

AFAIK, that's just not possible without some tricky formatting. For example, you could structure your report so that each page shows exactly 3 records at a time. Then, if your total record count is 4 (which isn't divisible by 3), you know that your last page will contain exactly 1 record.

Upvotes: 0

Buck Hicks
Buck Hicks

Reputation: 1574

If I understand you question correctly you should just be able to add a summary at the bottom of your page (maybe the Report Footer) to count an item in your details section. For instance I just opened up a report that I have and added a summary to count the number of zip codes in the details section.

enter image description here

The screen that you will see next allows you to select the Count for your summary.

enter image description here

Next I went to the Section Expert and put this in the X-2 box across from the Suppress check box in the Header Section.

enter image description here

If Count ({Stores.ZipCode}) > 50 Then True

This will suppress the header if I have more than 50 zip codes in my details section. In your case if your count is 0 then you would suppress. Is that what you were looking for?

Upvotes: 1

Related Questions