memo color according to value of the memo and value of a datafield

jjljjl
edited 11:28AM in FastReport 4.0
Hello,

I need to change one memo's color according to two conditionals with if in the event OnAfterData.
The first one is according to the value of the memo which is set in a columnfooter.
THe second one is according to the value of the field of a dataset which isn't set in any databand.
If I only vary the color of the memo according to its value, everything is going right.
However, when I add the second condition, the color of the memo varies in a way which seems arbitrary and which doesn't correspond to the second condition.
Here are the two conditions:
The first one:

procedure Memo12OnAfterData(Sender: TfrxComponent);
begin

if value<20 then memo12.color:=clRed
else
if (value>=20) and (value<22) then memo12.color:=clMoneyGreen
else
if value=22 then memo12.color:=clSkyBlue
else
if (value>22) and (value<=24) then memo12.color:=clMoneyGreen
else
if value>24 then memo12.color:=clRed;

end;

The second one:

procedure Memo12OnAfterData(Sender: TfrxComponent);
begin

if <dtsMtr."poste">='z' then
memo12.color:=clYellow
else
if <dtsMtr."poste">='a' then
begin
if value<10 then memo12.color:=clRed
else
if (value>=10) and (value<11) then memo12.color:=clMoneyGreen
else
if value=11 then memo12.color:=clSkyBlue
else
if (value>11) and (value<=12) then memo12.color:=clMoneyGreen
else
if value>12 then memo12.color:=clRed
end
else
if <dtsMtr."poste">='b' then
begin
if value<13 then memo12.color:=clRed
else
if (value>=13) and (value<14) then memo12.color:=clMoneyGreen
else
if value=14 then memo12.color:=clSkyBlue
else
if (value>14) and (value<=15) then memo12.color:=clMoneyGreen
else
if value>15 then memo12.color:=clRed
end;
end;

Could you tell me where is the mistake?
Many thanks.

jjl

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.