Home End User

print text of the selected item of a parameter lookup

edited July 2014 in End User
In a search screen of the report builder I have a lookup field.
Prior to preview the report, I need to display in a label, the text of
the selected item and not its value.
How do?
Know to display the value, the command is:
ReportBeforePrint procedure;
begin
Label1.Caption: = parameter1.value;
end;

Comments

  • edited July 2014
    Hi Fabricio,

    Using the various routines located in the TppLookupList class you can
    get the selected name or "text" before the report prints. Something
    like the following...

    procedure TForm2.ppReport1BeforePrint(Sender: TObject);
    var
    lParameter: TppParameter;
    liIndex: Integer;
    lsParamValue: String;
    begin

    lParameter := ppReport1.Parameters['Parameter1'];
    lsParamValue := lParameter.Value;
    liIndex := lParameter.LookupList.IndexOfValue(lsParamValue);
    ShowMessage(lParameter.LookupList.GetDisplayNameForIndex(liIndex));

    end;

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2014
    I tried to use the code sent but not accepted into the calc procedure
    ReportBeforePrint
    error: "Erro: ReportBeforePrint, Linha 15: Esperado: '( ou'[, mas ao
    invés encontrou 'IndexOfValue'."


    Em 10/07/2014 12:39, Nico Cizik (Digital Metaphors) escreveu:
  • edited July 2014
    Hi Fabricio,

    For future reference, please state that you are using RAP in your main
    post so we know which features you are utilizing.

    The code I posted will not function in RAP. You will need to create a
    passthru function in order to get the value you need. See the
    Developer's Guide and main RAP demo included with RB for passthru
    function examples.

    Best Regards,

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