Report with Code
Hello
I want the change the printed value of a field.
If the value is True I want to print 'Yes'.
I try to change on Delphi code on the OnGetText event but it doesn't have impact on the report.
I change the FastReport code on OnBeforePrint field event.
If i run the report from the designer it appear as expect but if I run the report from the program
it's has no impact.
What I'm missing?
Sorin
I want the change the printed value of a field.
If the value is True I want to print 'Yes'.
I try to change on Delphi code on the OnGetText event but it doesn't have impact on the report.
I change the FastReport code on OnBeforePrint field event.
If i run the report from the designer it appear as expect but if I run the report from the program
it's has no impact.
What I'm missing?
Sorin
Comments
Thanks but IIf function raise an error.
I use PascalScript
The IFF function can be sometimes be tricky. Write appropriate code in the script.
[/quote]
I use the basic sintax
"iif(<frdbBillB."Pay"> = True, frdbBillBPay.Text := 'Yes', frdbBillBPay.Text := 'No');"
It's raise the error ')' expected?
The IIF can be used in the MemoView, not in event script.
In the memo you can put something like:
[iif(<frdbBillB."Pay"> = True, 'Yes', 'No')]
Or if you want to use pascal code in script, you should try:
procedure MyMemoOnAfterData(Sender: TfrxComponent);
begin
if <frdbBillB."Pay"> = True then
TFrxMemoView(sender).Text := 'Yes'
else TFrxMemoView(sender).Text := 'No';
end;
Even building the expression using the expression builder sometimes cannot get the simplest expression to work.