Turning off a detail band.
I know this must be something very basic but I can't seem to find it in
the manuals or help screens or I'm not looking for the right key word.
(Delphi 6 / RB 6)
On BeforeDetailBandGenerate I do some logic test and find that I do not
want to print the detail band for that particular record -- how do I
turn it off for that one record?
Thanks.
the manuals or help screens or I'm not looking for the right key word.
(Delphi 6 / RB 6)
On BeforeDetailBandGenerate I do some logic test and find that I do not
want to print the detail band for that particular record -- how do I
turn it off for that one record?
Thanks.
This discussion has been closed.
Comments
the following and it worked just fine...
procedure TProductionReportDlg.ppDetailBand1BeforeGenerate(
Sender: TObject);
begin
if IBQuery2.FieldByName('STOCKNUM').AsString = '1274' then
IBQuery2.Next;
end;
Hope this helps,
Mark Greenhaw
President
Glory Road Enterprises
the last record in the table always prints, even if I skip it. The logic I
tried skips records in the DetailBandBeforeGenerate until it finds one to
print or until the table.eof is true.
set the band.visible prop to false
cu
marc
false at Table.Eof, if in preview mode, the report briefly displays then the
data disappears leaving only the headings. After changing to OnePass the report
the detail displays, but the last record that should not print still prints.
The last record prints whether generated in print or preview mode. (Printing
from the preview screen results in a report with headings and no data).
Using debug I can see that the last record is skipped and at Table.Eof the logic
does set the DetailBand.visible to false, but it still somehow prints that last
record.
Another interesting thing - if I do not set the DetailBand.Visible to True
outside of the DetailBandBeforeGenerate routine before printing the report
again, no detail data prints.
Thanks for the suggestions -- any more ideas?
if (needtoskip) then
ppReport1.Detail.Visible := False
else
ppReport1.Detail.Visible := True;
Don't set the visibility to True anywhere else - as this is likely the
problem...
--
Cheers,
Tom Ollar
Digital Metaphors Corporation
http://www.digital-metaphors.com
info@digital-metaphors.com
find the proper response. :-)
Table one is a customer record (cusid, name, address, etc.)
1,Bob,Bob's Address
2,Jim,Jim's Address
3,Joe,Joe's Address
4,Mary,Mary's Address
5,Sue,Sue's Address
Table two is a list of things a customer must do (doID, doText)
1, Bring in Phone Bill
2, Provide two references
3, Run a 10k marathon
4, Milk a cow
5, whatever... :-)
table three is a list of things each customer has done or not done (cusid,
doID, IsFinished)
1,1,True
1,2,True
1,3,False
3,1,False
3,2,True
3,3,True
3,4,False
A customer may have some, all, or none of the table two items represented in
table three and a customer may not even be listed in table three.
I want the report to print only those items from table two that the cutomer
in table one has NOT done. If the record is false, or if a record does not
exist in table three for that customer/doItem, then print the doText. If the
record is true, don't print it.
In my particular case it is the detail line of a subreport where the SQL
from the data pipleline SQL statement is
"select doText from Table 2". This would print each item in the order
returned by the SQL statement. in the detail band before generate event for
the subreport, I am trying to do the following but to no avail...
procedure TOpenStipDlg.ppDetailBand2BeforeGenerate(Sender: TObject);
begin
if ibqLookup.Active then ibqLookup.Close;
if ibtLookup.Active then ibtLookup.Commit;
ibqLookup.ParamByName('MasID').AsInteger :=
ibqList.FieldByName('CusID').AsInteger;
ibqLookup.ParamByName('SID').AsInteger :=
ibqSL.FieldByName('SID').AsInteger;
ibqLookup.Open;
if ibqLookup.RecordCount > 0 then
begin
if ibqLookup.FieldByName('IsFinished').AsString = 'T' then
ppDetailBand2.Visible := False {if the customer
has completed it, DON't print it}
else ppDetailband2.Visible := True; {if the customer
has not completed it then print it}
end else ppDetailband2.Visible := True; {if the record does
not exist, the customer has not completed it so print it}
end;
The BeforeGenerate event for this band is only fired TWICE with this code.
I am printing TWO customers and there are FIVE items in Table2. Shouldn't
this be fired ten times? One for each item originally set to print?
Mark Greenhaw
Vulcan Software Systems
worked perfectly.
Mark Greenhaw
Vulcan Software Systems