-1

I have a problem with an IF statement in FastReport.
I want to check if ProgramName = "", then change Memo1.Text = "ONLY FOR CALCULATION", if not, then "OTHER"

procedure rara(Sender: TfrxComponent);
var
ProgramName : sring;
begin
ProgramName := <Nest."PrgName">;

if ProgramName = "" then
begin                                
       memo1.Text = "ONLY FOR CALCULATION";                
       end
else
       begin
       Memo1.Tex = "OTHER";                                                             
       end
end;

end;

The error I see is:

'THEN' Expected

Do you have any ideas?

zx485
  • 28,498
  • 28
  • 50
  • 59
Dashiphone
  • 59
  • 1
  • 9
  • 1
    I do not know Fast Report. But in general, in Pascal (Script) 1) You use single quotes, not double-quotes, for strings. 2) It's `string`, not `sring`. 3) It's `.Text`, not `.Tex`. 4) For assignment you use `:=`, not `=`. 5) You have more `ends` than `begins`. – Martin Prikryl Sep 24 '19 at 19:43

1 Answers1

1

If you use Fast Report, probably this script is the OnBeforePrint event handler for one of the TfrxMemoView components. The event handler should look like this (as @MartinPrikryl commented).

procedure Memo1OnBeforePrint(Sender: TfrxComponent);
var
   ProgramName : string;
begin
   ProgramName := <Nest."PrgName">;
   if ProgramName = '' then begin                                
      Memo1.Text := 'ONLY FOR CALCULATION';                
      end
   else begin
      Memo1.Text := 'OTHER';                                                             
   end
end;

Note, that <Nest."PrgName"> returns the value for PrgName column from the Nest report dataset.

Zhorov
  • 28,486
  • 6
  • 27
  • 52