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

Accessing multiple parameter values in RAP

edited May 2010 in RAP
Hi,

Delphi 6, RB 11.08 Enterprise

I have a parameter set up where the AutoSearchSettings.SearchOperator is
soInList and the LookupList is populated with some possible values. However,
I cannot see how I can access which values the user has selected in the RAP.

I have tried this code:

for i := 0 to Report.Parameters['paramEG'].ValueCount - 1 do
begin
sEthnicCode := Report.Parameters['paramEG'].Values[i];
end;

However, this returns an error in the RAP:

Expected '(' or '[', but found 'ValueCount' instead

If I remove that line, the error simply moves to the 'Values' line instead.

Expected '(' or '[', but found 'Values' instead

I have also noticed that the help on TppReport.Parameters specifically
states:

---
At run-time, use the methods of TppParameterList to programmtically access
the custom parameter items. The Delphi code syntax for accessing a parameter
value is

myReport.Parameters['ParameterName'].Value

RAP code supports the above syntax, plus the following shorthand syntax

myReport.Parameters['ParameterName']
---

I have found that the latter option works
(myReport.Parameters['ParameterName']) but the former option
(myReport.Parameters['ParameterName'].Value) produces a similar error,
despite the help saying both are supported in RAP:

Expected '(' or '[', but found 'Value' instead

Am I missing something here?

Thanks
Jason.

--
Jason Sweby
Software Development Manager,
Carval Computing Limited, Plymouth, UK

Payroll - HR - T&A - Access Control

Comments

  • edited May 2010
    Interestingly, if I declare a variable of type TppParameter, I can then
    access the Value propery in the RAP, but still cannot access the Values or
    ValueCount properties.

    var
    sCode: String;
    lParam: TppParameter;
    begin
    lParam := Report.Parameters['paramEG'];

    sCode := lParam.Value; {Works}

    if (lParam.ValueCount > 0) then {Error here - 'ValueCount'}
    sCode := lParam.Values[0]; {Error here - 'Values'}
    end;

    Jason.


  • edited May 2010
    Hi Jason,

    The TppParameter.Values property is currently not included with the RAP
    RTTI. We will see about adding it for the next maintenance release of
    ReportBuilder.

    As a workaround you could create a passthru function that assigns this
    property.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2010
    Thanks Nico

    Would you consider adding it to a release of RB v11 (or a patch), as I
    cannot justify the upgrade to v12 at this time?

    Jason.

  • edited May 2010
    Jason,

    There information in the Developers Guide tutorials on extending RAP with
    additional RTTI and custom functions. Working demos and tutorials are also
    installed with the product.

    Going I recommend updating to RB 12, as we will be actively maintaining the
    RB 12 code base with patches and maintenance releases.

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



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited May 2010
    Hi Nard

    Thank you for responding.

    I have written custom functions for RAP before, I was just hoping this might
    be something we could expect as standard, because as it currently stands,
    multi-value parameters can't be used in reports that don't have any code
    behind them.

    We will probably upgrade eventually but for the moment, the $599 RB Server
    upgrade is a lot to pay for a fix, as I already use the Waler components
    that provide most of the new export functions added in v12.

    Regards,
    Jason.

This discussion has been closed.