Ankit Agarwal

Ankit Agarwal

  • NA
  • 379
  • 253.4k

How to set conditional formatting in crystal report?

Jul 30 2018 2:39 AM
Hello,
 
How will be set conditional formatting in Crystal Report according to Database column value.
 
My Database table data:-
 
select Id,OutputFormat from FormatSample
 
Result
 
Id OutputFormat
1 WordStyle=Normal,BgColor=White,TextColor=Black,Font=Vodafone Lt,FontSize=11,MergeCount=10,MergeStartPosition=2
2WordStyle=Normal,BgColor=LightGreen,TextColor=Black,Font=Vodafone Lt,FontSize=11
3WordStyle=Bold,BgColor=Red,TextColor=White,Font=Vodafone Rg,FontSize=18,MergeCount=10,MergeStartPosition=2
4WordStyle=Normal,BgColor=White,TextColor=Black,Font=Vodafone Lt,FontSize=11,MergeCount=5,MergeStartPosition=2
 
or please suggest me best way for complete this task.
 
Please help me, how can we achieve this task?
 
I have tried this code but its getting error:-
 
local stringvar array x:= Split({FormatSample.OutputFormat},",");
Local numberVar i;
Local numberVar k;
Local stringVar array outputString := "";
Local stringVar BgColor;
For i:=1 to Count(x) do
(
outputString := outputString + x[i];
for k:=1 to Count(outputString) do
(
Local stringVar array Keyvalue := Split((outputString[k]),"=");
if Keyvalue[0]=BgColor then
if Keyvalue[1]="Red" then
crRed
);
);
 
error:- A number or currency amount is required.
 
Thanks in Advance.

Answers (2)