Script error: undeclared identifier

edited 6:44PM 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:44PM
    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:44PM
    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:44PM
    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:44PM
    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

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.