Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

PrintToDevices and OnGetAutoSearchValues

edited March 2008 in General
Hello,

I'm using PrintToDevices to generate report to an archive.
PrintToDevices doesn't call the OnGetAutoSearchValues event.

It only works, when I call DisplayAutoSearchDialog before PrintToDevices.

You'll find my code at the end of this message.

Any ideas?

Thank you!

Lars Hirthe


CODE:
--------
...
var
BlobStream : TStream;
ArchiveDevice : TppArchiveDevice;
begin
...
ppReport.DeviceType:=dtArchive;
ArchiveDevice:=TppArchiveDevice.Create(nil);

with qryReportArchive do
try
ppReport.OnGetAutoSearchValues:=GetAutoSearchValuesFromParams;
Params[0].AsInteger:=AIDreportarchive;
Open;
if AIDreportArchive>0 then
Edit
else
Insert;
BlobStream:=CreateBlobStream(FieldByName('Data'),bmWrite);
BlobStream.Seek(0,soFromBeginning);
ArchiveDevice.OutputStream:=BlobStream;
ArchiveDevice.Publisher:=ppReport.Publisher;
// ------------------------------
ppReport.SendEventNotify(ppReport,
ciReportBeforeAutoSearchDialogCreate, NIL);
ppReport.SendEventNotify(ppReport, ciReportGetAutoSearchValues, NIL);
// ------------------------------
ppReport.PrintToDevices;
BlobStream.Free;
Post;
AIDReportArchive:=FieldByName('ID').AsInteger;
finally
Close;
ArchiveDevice.Free;
ppReport.OnGetAutoSearchValues:=nil;
end;
end;

Comments

This discussion has been closed.