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

Set report parameter from RAP

edited February 2010 in RAP
Hi,

How to set a report parameter from RAP.
I use Report.Parameters['paramname'] := from
OnInitializeParameters() but the value doesn't seem to be stored.

Using RB10.06

Regards,
Jeroen.

Comments

  • edited February 2010
    Hi Jeroen,

    This is currently a limitation of RAP. We are strongly considering adding
    this capability for the next major release of ReportBuilder.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2010
    Hi Nico,

    Ouch! Please consider it.
    When a parameter is connected to an autosearchvalue the autosearch value is
    also not accessible from Reports.AutosearchValues[], making connecting a
    parameter to a query a lot less interesting.
    Eg. I use OnInitializeParameters() to init a weekreport with dynamic default
    dates for a query so a user most of the time only clicks OK.

    Regards,
    Jeroen.


  • edited February 2010
    > Ouch! Please consider it.

    The limitation can currently be worked around by creating a simple pass thru
    function.


    Do you perhaps mean the Report.AutoSearchFields[].Value property? This is a
    read only property. If you would like to assign a value to an
    AutoSearchField, you should use the
    Report.AutoSearchFields[].SearchExpression property. This however is not
    necessary if the parameter value is updated while connected to the
    AutoSearch field.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2010
    Hi Nico,

    thru
    Didn't think about that. Will try that next week.

    Regards,
    Jeroen.

  • edited March 2010
    Hi,

    That seems to work as aspected.

    { TRapSetReportParameter }

    class function TRapSetReportParameter.GetSignature: String;
    begin
    Result := 'procedure SetReportParameter(aReport: TppReport; aParameter:
    string; aValue: Variant);';
    end;

    class function TRapSetReportParameter.IsFunction: Boolean;
    begin
    Result := False;
    end;

    procedure TRapSetReportParameter.ExecuteFunction(aParams: TraParamList);
    var lReport: TppReport;
    lParam: string;
    lValue: Variant;
    begin
    GetParamValue(0, lReport);
    GetParamValue(1, lParam);
    GetParamValue(2, lValue);
    if Assigned(lReport)
    then lReport.Parameters[lParam].Value := lValue;
    end;



  • edited March 2010
    Great! Glad you got it working.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.