if then else sentence

HedleyHedley Peru
edited 3:05PM in FastReport 4.0
i have this procedure

procedure Memo3OnBeforePrint(Sender: TfrxComponent);
begin
line1.frame.color := clBlue;
line5.frame.color := clBlue;
if (SUM(<data."IMPOA">) > 0) then
line1.frame.color := clRed;
line5.frame.color := clRed;
end;

but this line5.frame.color := clRed; always execute ...

i change to

if (SUM(<data."IMPOA">) > 0) then
line1.frame.color := clRed;
line5.frame.color := clRed;
else
line1.frame.color := clBlue;
line5.frame.color := clBlue;

but i receive an error... i read the users manual and programmers manual, but the examples only have one line

please how to write many sentences for "then" and "else"

thanks

Hedley

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 3:05PM
    you can use begin end blocks just like in delphi
    begin
    if (SUM(<data."IMPOA">) > 0) then
    begin
    line1.frame.color := clRed;
    line5.frame.color := clRed;
    end
    else
    begin
    line1.frame.color := clBlue;
    line5.frame.color := clBlue;
    end;
    end;
    but you must remember that items that have been processed already by the engine cannot be modified from the event of an object that is processed later.
    ie bands are processed top down in order of type, objects within the band are processed in order of creation.

  • HedleyHedley Peru
    edited 3:05PM
    Dear Gordk :

    thanks a lot

    Hedley

Leave a Comment