Report with Code

edited 11:05PM in FastReport 4.0
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

Comments

  • gpigpi
    edited 11:05PM
    Use IIF function
  • edited 11:05PM
    gpi wrote: »
    Use IIF function

    Thanks but IIf function raise an error.
    I use PascalScript
  • edited 11:05PM
    sorinh wrote: »
    sorinh wrote: »
    Use IIF function

    Thanks but IIf function raise an error.
    I use PascalScript
    The IFF function can be sometimes be tricky. Write appropriate code in the script.
  • edited 11:05PM
    [/quote]
    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?

  • edited 11:05PM
    sorinh wrote: »
    I use the basic sintax
    "iif(<frdbBillB."Pay"> = True, frdbBillBPay.Text := 'Yes', frdbBillBPay.Text := 'No');"

    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;

  • edited 11:05PM
    Thanks
  • edited 11:05PM
    sorinh wrote: »
    I use the basic sintax
    "iif(<frdbBillB."Pay"> = True, frdbBillBPay.Text := 'Yes', frdbBillBPay.Text := 'No');"
    It's raise the error ')' expected?
    Exactly. I said tricky but read it as prone to producing error messages for no apparent reason.
    Even building the expression using the expression builder sometimes cannot get the simplest expression to work.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.