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

Need variable from Delphi form in RAP

edited August 2006 in RAP
Hi,

On Form1 (in Delphi application) the end-user can select some options through
checkboxes.
One of these checkboxed is needed to show/hide a certain field on the report.

************************************
procedure TimesOnPrint;
begin
If Form1.cbTimesShow.Checked then
Times.Visible := True
else
Times.Visible := False;
end;
************************************

Is there a way to make the value of the checkbox "Form1.cbTimesShow.Checked"
available in RAP?

Regards,
Stef

Comments

  • edited August 2006
    Hi Stef,

    Yes, you can do so using report parameters. Take a look at the
    Report.Parameters property and its topic in the RBuilder help. Also, below
    is a small example of how it can be used with RAP.

    http://www.digital-metaphors.com/tips/SimpleParameters.zip

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2006
    Thank you Nico!

    That is exactly what I needed to know.

    Regards,
    Stef
  • edited August 2006
    Hello Nico,

    I can't get it to work.

    I've created parameter on ppReport1 as dtBoolean:
    After pushing the Print-button I assign the value of MyCheckbox to it, like:

    ppReport1.Parameters['cbToonTijden'].Value := MyCheckbox.Checked;

    This is the code in RAP on the **SUB**-report field.
    If Trunc(FacturenUITDetails['Datum']) = 0 then
    Tijden.Visible := False
    else
    Tijden.Visible := ppReport1.Parameters['cbToonTijden'];

    Do you have any suggestions? What am I missing?

    Regards,
    Stef
  • edited August 2006
    Hello Nico,

    Error in RAP:
    Undeclared identifier ppReport1.

    Regards,
    Stef
  • edited August 2006
    Hi Stef,

    In RAP you do not need to use the Delphi name of the report. Simply use
    "Report".

    Report.Parameters[...

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2006
    Hello Nico,

    Well still no luck.

    procedure TijdenOnPrint;
    begin
    If Trunc(FacturenUITDetails['Datum']) = 0 then
    Tijden.Visible := False
    else
    Tijden.Visible := Report.Parameters['cbToonTijden'];
    end;

    Error: Expected '(' or '[' but found 'Parameters' instead.

    Regards,
    Stef
  • edited August 2006
    Hello Stef,

    Could it be because I try using it on a ppChildReport1 (subreport)?
    And if so, how can I access the parameter from the ppChildReport1, as the
    ppChildReport1 doesn't have it's own parameters property?

    Regards,
    Stef
  • edited August 2006
    Hello Nico,

    I got it.

    procedure TijdenOnPrint;
    var HoofdRapport : TppReport;
    begin
    HoofdRapport := TppReport(Report.MainReport);
    If Trunc(FacturenUITDetails['Datum']) = 0 then
    Tijden.Visible := False
    else
    Tijden.Visible := HoofdRapport.Parameters['cbToonTijden'];
    end;

    Thanks for all the help.
    Stef
This discussion has been closed.