Number of details records on the crystal report pa

2019-07-24 08:07发布

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.

4条回答
我想做一个坏孩纸
2楼-- · 2019-07-24 08:58

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?

查看更多
霸刀☆藐视天下
3楼-- · 2019-07-24 08:59

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
查看更多
混吃等死
4楼-- · 2019-07-24 09:03

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.

查看更多
叼着烟拽天下
5楼-- · 2019-07-24 09:09

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

查看更多
登录 后发表回答