I'd like to suppress a page header if the page has no data records.
Notes
- The page may still need to display in order to show the group or report footers.
- I'm interested in the case where there are no records for the details section of the report for the current page. I'm referring to a situation where all details records have been displayed for a group, but the group footer wraps to the next page.
Assuming you have Keep Together checked for the group footer, try entering the following in the conditional suppress formula for the page header section in the section expert:
OnLastRecord or {GROUP FIELD NAME} <> Next({GROUP FIELD NAME})
where {GROUP FIELD NAME} is the name of the grouping field.
OnLastRecord must come first in the formula, because if the last page of the report has no detail records (so that the page header should be suppressed), then Next({GROUP FIELD NAME}) evaluates as NULL and all conditions that come after it are also evaluated as NULL.
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
Right-Click Page Header
Choose Section Expert
"Suppress (No Drill-Down)" is not Checked But add this formula:
pagenumber = totalpagecount
To check if details section is empty or not,you can use following statement in suppress formula of section which you want to hide
if(NextIsNull(EnterFieldofNextSectionHere)) then
true
else
false