views:

341

answers:

2

I'm creating my first report with Rave Reports for delphi. I've got the records displaying nicely and I'm on the final stretch before finishing. I have a set of records which I'm displaying with an if statement on the before print event ONLY if the 'comment' field on the record has data (which is string data). This The problem I have is that when no records are shown I'm still seeing my header and footer. How can I hide the header and footer if I have no records with data in their 'comment' field?

A: 

I'm not familiar with Rave Reports but could you not default the header and footer to not being visible and then in the beforeprint, set them visible when you execute the code that triggers when the comment data is present.

Simon

Simon Temlett
A: 

Hi Simon, Thanks for the help. It lead me to solve the problem. I was clearly overthinking the obvious yesterday. I tried doing what you suggested and whilst it worked for no results when I had results it was missing the header and footer off the first page (the odd thing was the header and footer were present on the second page).

I then looked into the OnBeforePrint event on the actual header band. I didn't think this would connect to the dataview for some reason as I thought only the databand would have access to the data. I tried the if statement in their and it's worked.

In case anyone else comes across this here is the code from my OnBeforePrint event in my header databand:

if dvInvLineLineComment.AsString <> '' then
 bNotesHeadings.Visible := true;
end;

and my code for the databand which hides the row if no LineComment field carries data:

if dvInvLineLineComment.AsString = '' then
 dbNotes.Visible := false;
else
 dbNotes.Visible := true;
end;

Hope that helps someone in the future

Lloyd

lloydphillips
Turns out this didn't work as it was simply testing the last record and basing the header and footer visibility on that. So I'm still stuck. Any further answers would be really appreciated. The Rave documentation is a little bit pap.
lloydphillips