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.
标签:
crystal-reports
相关问题
- Crystal Report SP26 SetDataSource() Method failed
- Crystal Report in .NET Framework 4.0
- right to left string in crystal report
- Loading Crystal Report from embedded resource
- Suppress Nonadjacent Duplicates in Report
相关文章
- What is the best way to cleanup the resources used
- How to pass a list of values into a crystal report
- Crystal Report Sub Report Page Break
- Issue related to vertical line in Crystal Reports
- Dynamically change database type, source etc in Cr
- Converting total time in integer into HH:MM format
- Crystal Report: How to evaluate multiple IF statem
- How to resolve Crystal Report version conflict and
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.
The screen that you will see next allows you to select the Count for your summary.
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.
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?
First, you have to create a formula. Then, insert it into to the
Details
section. For example@VariableA
Inside the formula, put this:
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:
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.
Just using "OnLastRecord" in the Supress formula for PageHeader will solve the purpose.