Suppression of data from a particular section on selected pages in Crystal Report
Crystal Reports version:
In Crystal, as we know, there are mainly 5 sections viz. report header, page header, detail section, report footer and page footer. The data fields and labels included in page header and page footer sections will be displayed on all pages of the report; likewise the fields used in report header and report footer sections will be displayed only on first and last pages of the report. Normally the selection criteria information used for a report will be displayed at the end of the report.
1) Screenshot with page header and detail section
Suppose we have 20 pages of output including selection criteria (which is displayed at the end of the report via report footer section i.e. after detail section data is displayed). Say 15 pages of detail section data and 5 pages of selection criteria data is there. Now the requirement is such that we need to display the page header section data only on pages where detail section data is getting displayed and the same needs to be suppressed on pages where selection criteria is displayed (in this case, it’s from page 16 to 20, but this will be dynamic in real scenario). Please check the above screenshots for sample example.
To achieve this, we need to follow the steps as below:
- Create a formula say “fr_txt_dyn_suppress” and include formula content provided below
Global booleanvar flag1:= true;
- Insert this formula on all the report footer sections in which selection criteria fields are included and suppress the field by right clicking and navigating in the path Format Field -> Common and check the “Suppress” checkbox.
- Now, right click on the page header section which needs to be suppressed on selection criteria page and navigate to Section Expert – > Common and modify the formula content against “Suppress (No Drill-Down)” field by clicking on X+2 button and include below code
Global booleanvar flag1;
If flag1 = true then true;
- The above formula is to suppress the page header section when it finds any section which has flag1 set as true. In this case, we have flag1 set to true in report footer section which has selection criteria fields.