memo color according to value of the memo and value of a datafield
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
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