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?
2 Answers
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