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

Using GetParamValue and SetParamValue

edited October 2006 in General
Hello All!

I am using v10.03 and I have a question about using the functions above.

Below is a block of code that I recently encountered. Within that block
of code, the two functions are used.

My question are, what exactly happens when GetParamValue and SetParamValue
is called? And, is it possible to use either of these functions to pass a
value in at runtime
to be operated upon, if this is not what is actually already happening with
either of the function calls?

Thanks in advance for any/all replies.

Everett
=======================================================================

{ TraConfigSettingFunction }
procedure TraConfigSettingFunction.ExecuteFunction(aParams: TraParamList);
var
sSettingName: String;
aResult : Boolean;
begin
try
aResult := False;
GetParamValue(0, sSettingName); //What does this do?
aResult:= (ConfigSettingsSingleton.Items.IndexOf(sSettingName) <> -1);
SetParamValue(1, aResult); //What does this do?
except
on E: Exception do begin
LogNTEventSilent(etError, ctErrors,
'An error occurred in Print Server Method "procedure
TraConfigSettingFunction.ExecuteFunction"' +
#13#10 + #13#10 +
E.Message);
end;
end;
end; {procedure, ExecuteFunction}

Comments

  • edited October 2006
    Hi Everett,

    For future reference, it is best to post RAP questions in the RAP newsgroup.
    This helps us provide a more accurate answer and a quicker response.

    When creating a RAP passthru function you use the ExecuteFunction to
    retrieve any parameters given by the code in RAP and set a return value to
    the call if needed. The TraParamList holds these values. The first values
    in the ParamList are the parameters defined in RAP (from the function call).
    The last parameter is to be set inside the ExecuteFunction routine in Delphi
    as a return value. Take a look at the passthru function below for a classic
    example. As you can see the actuall signature of the function in RAP takes
    a string parameter and returns a string parameter. In the ExecuteFuction
    procedure, you can see that the first parameter is extracted using
    GetParamValue, then processed in Delphi and then the return value is set
    using the SetParamValue.

    If you are looking to simply pass a value from Delphi to be used in RAP,
    take a look at the Report.Parameters property in the RBuilder help.


    {------------------------------------------------------------------------------}
    { TmyExtractFilePathFunction.GetSignature }

    class function TmyExtractFilePathFunction.GetSignature: String;
    begin
    Result := 'function ExtractFilePath(const FileName: string): string;';
    end; {class function GetSignature}

    {------------------------------------------------------------------------------}
    { TmyExtractFilePathFunction.ExecuteFunction }

    procedure TmyExtractFilePathFunction.ExecuteFunction(aParams: TraParamList);
    var
    lsResult: String;
    lsString: String;
    begin

    GetParamValue(0, lsString);

    lsResult := ExtractFilePath(lsString);

    SetParamValue(1, lsResult);
    end; {Procedure ExecuteFunction}

    --
    Regards,

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

    Best Regards,

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

    Thank you very much for your reply!

    My apologies to all of the group for posting in the incorrect forum; I
    overlooked it.

    Nico, thanks for your feedback; that really does help a lot.

    Regards,
    Everett

This discussion has been closed.