print text of the selected item of a parameter lookup
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;
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;
This discussion has been closed.
Comments
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;
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
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:
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.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com