Script error: undeclared identifier

edited 6:22PM in FastReport 4.0
Anybody has meet the similar error:
Scrip error at 3:14: Undeclared identifier:'Memo22'

Memo22 is a text field which placed in report title

Script do some checking on before print:
procedure Memo22OnBeforePrint(Sender: TfrxComponent);
begin
with Memo22, Engine do
begin
...
end

The error doesn't happen every time, only sometime will appear.

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 6:22PM
    first memo22 is not a text object it is a tfrxmemoview object which has a memo property which is a stringlist of text.
    the error is directing you to line3 character14 as the best bet as to where the error is.
    i suspect your error is in the code in the begin end block that you did not show
  • edited 6:22PM
    Oh, yes. The memo22 is a tfrxmemoview object. The code in the begin end block is very simple:

    Begin
    if <Query1."REPRINT"> = 1 then Memo22.Visible := true
    else Memo22.Visible := false
    End;
  • gordkgordk St.Catherines On. Canada.
    edited 6:22PM
    you can use the shorter form no need to call the engine.
    procedure Memo22OnBeforePrint(Sender: TfrxComponent);
    begin
    memo22.visible :=(<Query1."REPRINT"> = 1);
    end;

    the empty Begin End. block at the bottom of the code page can be used to initialize variables, create arrays etc.. it is the first to run in the script.
  • edited 6:22PM
    Thank you! It seems ok now. In fact, I use short form first, but it won't work, but this time it work when I change back. ha, any way, thank you so much. >

Leave a Comment