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

Passthru function being called when printer selected in print dialog

edited March 2011 in RAP
Hello,

Using
Delphi 2007
ReportBuilder 12.03 enterprise

I have an end-user reporting application in which I use a passthru
function to prompt for a client ID (the function allows the user to
look-up the client by name and returns the client ID to the report).

The function (GetClientOnlyPrompt) is called in the event
ReportBeforeOpenDataPipelines.

Said procedure is shown below.

(ReportBeforeOpendataPipelines event)
var
lSQLBuilder: tdaSQLBuilder;
sReportStartdate, sReportEndDate: string;

begin
GetClientOnlyPrompt(gClientSelection, gCancelReport);
if gCancelReport then
showmessage('Report cancelled')
else
begin
lSQLBuilder := TdaSQLBuilder.create(Report.dataPipeline);
lSQLBuilder.SearchCriteria[0].value := gClientSelection;

{ showmessage(gclientSelection);
Showmessage(lSQLBuilder.SQL.SQLText.Text);
}
lSQLBuilder.Applyupdates;
lSQLBuilder.Free;
end;
end;

This report breaks in the following scenario:
1) Open the report with print-preview option
2) The passthru function is displayed and prompts the user for the
client ID.
3) Client selection is passed to the report and the report is shown in
the preview screen correctly
4) Click on the printer icon in the preview screen
5) Change the printer in the print dialog window
6) Report breaks because, apparently, it is firing the
ReportBeforeOpenDataPipelines event again - and waiting for the passthru
function to return a value.

If I skip step 5 - and do not change the printer selection in the print
dialog, the report prints without a problem.

Is there a different event I can use that won't be fired by a printer
selection in the dialog? Or is there a way to prevent the passthru
function from being called subsequently?

Thanks, as always, for your great help.
Phil Horst

Comments

  • edited March 2011
    Try using Report.OnInitializeParameters. It is designed to fire a single
    time.

    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited March 2011
    On 3/9/2011 3:52 PM, Nard Moseley (Digital Metaphors) wrote:

    That works. Thanks!
    Phil
This discussion has been closed.