Click here to Skip to main content
15,613,716 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

How will be set conditional formatting in Crystal Report according to Database column value.
My Database table data:-

select Id,OutputFormat from FormatSample
Id OutputFormat
1 WordStyle=Normal,BgColor=White,TextColor=Black,Font=Vodafone Lt,FontSize=11,MergeCount=10,MergeStartPosition=2
2 WordStyle=Normal,BgColor=LightGreen,TextColor=Black,Font=Vodafone Lt,FontSize=11
3 WordStyle=Bold,BgColor=Red,TextColor=White,Font=Vodafone Rg,FontSize=18,MergeCount=10,MergeStartPosition=2
4 WordStyle=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?

Thanks in Advance.
Ankit Agarwal

What I have tried:

I am using this code for change background color.
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

its getting error:-
A number or currency amount is required.
Updated 6-Jan-21 20:33pm

1 solution

For numbers, you need to convert the value before doing anything. In your code, you have used Count for some value.

For example use(ToNumber is just an example, there're some more things to be used any other errors)

instead of
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900