if then else sentence

HedleyHedley Peru
edited 10:13PM 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 10:13PM
    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 10:13PM
    Dear Gordk :

    thanks a lot

    Hedley

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.