Crystal Reports - Hide the page title if there is no record on the page

How to hide the page title if there is no entry on the last page (information section). The page title should be displayed on the last page if some data on the last page otherwise hides the page title.

Formaula pagenumber = totalpagecount will not work, as it will always suppress the last page title.

+4
source share
3 answers

Put this formula in the suppressed field in the detailed section:

 WhilePrintingRecords; Global BooleanVar finished; finished := OnLastRecord 

And make it the Suppress formula in the page title:

 Global BooleanVar finished 
  • Before finished is initialized, the page title will show.
  • After printing the detailed record, it will be set to false .
  • When you finally get to the last part section, finished set to true .
  • If you manage to get to a different page title, finished is still true , and Crystal will suppress the title.

This is an interesting problem. I used to come across this behavior, but I never tried to solve it. I think you need to use a variable, because in the page header the usual parameters, such as Next() and OnLastRecord , cannot distinguish the presence of one other record for printing and not have more records for printing. I think that the final results of the execution will have the same problem - the values ​​will be the same on the page with one more record for printing and on the page without records for printing. A.

+13
source

I found a better and working solution for this answer (just slightly modified the Noa code):

 WhilePrintingRecords; Global BooleanVar finished; finished := OnLastRecord AND NOT OnFirstRecord 

and it works even if the details contain only one line.

+4
source

You may be able to adapt Crystal Reports: display a message when the report has no data to suit your needs.

+1
source

Source: https://habr.com/ru/post/1379299/


All Articles