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

RAP and Parameters

edited December 2003 in RAP
Hi there,

I am using Report Builder 7.03 with Delphi 7 Architect.

I am setting the parameters before I call the myReport.Print method and I am
populating some report labels from these parameters in the
myReport.ReportBeforePrint. The report labels are coming out blank. Any
ideas? See code below:

*** In Delphi Code ***
procedure PrintReport;
begin
rbrSupportForm.Parameters.Items['paramCompanyName'].Value :=
edtCompanyName.Text;
rbrSupportForm.Parameters.Items['paramReportedBy'].Value :=
edtReportedBy.Text;
rbrSupportForm.Parameters.Items['paramContactNumber'].Value :=
edtContactNumber.Text;
rbrSupportForm.Parameters.Items['paramSoftwareName'].Value :=
cbxSoftwareName.Text;
rbrSupportForm.Parameters.Items['paramSoftwareVersion'].Value :=
edtSoftwareVersion.Text;

rbrSupportForm.Print;
end;

*** Within RAP Code ***
procedure ReportBeforePrint;
begin
pp_CompanyName.Caption := Report.Parameters['parmCompanyName'];
pp_ReportedBy.Caption := Report.Parameters['parmReportedBy'];
pp_ContactNumber.Caption := Report.Parameters['parmContactNumber'];
pp_SoftwareName.Caption := Report.Parameters['parmSoftwareName'];
pp_SoftwareVersion.Caption := Report.Parameters['parmSoftwareVersion'];
end;

Thank in advance and merry Christmas,
--
Justin Heasman
Software Development Manager
Office Mobile Solutions Ltd.
---
E: justinDEFINATELY@NOofficemobilesolutionsSPAM.PLEASEcom
W: www.officemobilesolutions.com

Comments

  • edited December 2003

    Perhaps make sure that you are using the correct parameter name and that the
    datatype is a string value.


    Using RB 7.03, I just created a simple test report and it works properly.

    I created a single report parameter with a datatype of dtString.

    procedure TForm2.Button1Click(Sender: TObject);
    begin
    ppReport1.Parameters.Items['ppParameter1'].Value := 'Test RB Params';
    ppReport1.Print;

    end;

    RAP code....

    procedure ReportBeforePrintl;
    begin
    Label1.Caption := Report.Parameters['ppParameter1'];

    end;




    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com
    "Justin Heasman (OMS Ltd)"

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited January 2004
    Hi,

    Thanks, I have now got it printing what I expect, but I have a senario see
    below that is causing problems:

    I have a form with a few edit boxes on it, a print button and a RB7 report
    component.
    When you click on the print button it assigns the values in the edit boxes
    to the relevent parameters in RB7
    Using the ReportBeforePrint RAP event of the report I assign the strings in
    the parameters to the report labels
    You get a print preview and it all looks fine.
    After you close the print preview and then change some of the data in the
    edit boxes and click the print button again you still get the same results
    and none of the changed data is printed (it still displays what you had
    there before) on the preview even though it has gone through the same
    procedure.

    I am not doing anything special here

    The print button assigns the values to the params and the reportbeforeprint
    RAP event moves the param values tot he captions. Thats it.

    Can you please explain why this is happening.

    Many thanks and best regards,
    --
    Justin Heasman
    Software Development Manager
    Office Mobile Solutions Ltd.
    ---
    E: justinDEFINATELY@NOofficemobilesolutionsSPAM.PLEASEcom
    W: www.officemobilesolutions.com

  • edited January 2004

    Try calling Report.Reset prior to Report.Print.


    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com
    "Justin Heasman (OMS Ltd)"

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.