Solved

# crystal 10  coloring problem (red,yellow,green,blue)

Posted on 2004-10-08
Medium Priority
480 Views

I have 4 values of a field (osg_fbct_db_viewW_count.CountOftsname) the max value color needs to be Red,the least value needs to be blue.

the 2 values in between need to yellow and green.
its like red<yellow,green<blue

I coded::
if
{osg_fbct_db_viewW_count.CountOftsname} =maximum({osg_fbct_db_viewW_count.CountOftsname})
then
color(150,230,200)

else

color(10,19,200)

its not working.....
0
Question by:manassahu
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 3

LVL 42

Accepted Solution

frodoman earned 2000 total points
ID: 12259750
Where are you putting this code?  What are you trying to accomplish?
0

LVL 28

Expert Comment

ID: 12260754

Right click the field, and choose format field.
Under the Font tab, click the x+2 button to the right of color, and enter the following logic:

if {osg_fbct_db_viewW_count.CountOftsname} = maximum({osg_fbct_db_viewW_count.CountOftsname}) then
crRed
else if {osg_fbct_db_viewW_count.CountOftsname} = NthLargest(2,{osg_fbct_db_viewW_count.CountOftsname}) then
crYellow
else if {osg_fbct_db_viewW_count.CountOftsname} = NthLargest(3,{osg_fbct_db_viewW_count.CountOftsname}) then
crGreen
else if {osg_fbct_db_viewW_count.CountOftsname} = minimum({osg_fbct_db_viewW_count.CountOftsname}) then
crBlue
else
crBlack

The last else isn't necessary if you only have 4 values, but it is a catch all if there are any extra values.
0

Author Comment

ID: 12260852
I go to section expert ,
click on the section header which has the field  CountOftsname),
then click on color
then put muy code in formula workshop..

This is the code I just ran

If ({osg_fbct_db_viewW_count.CountOftsname})=
Maximum ({osg_fbct_db_viewW_count.CountOftsname}, {osg_fbct_db_viewW_count.CY_CYCLE}) Then
crRed
Else
If ({osg_fbct_db_viewW_count.CountOftsname})=
Minimum ({osg_fbct_db_viewW_count.CountOftsname}, {osg_fbct_db_viewW_count.CY_CYCLE}) Then
crBlue
Else
DefaultAttribute

this runs well the O/p is

1.max value of  CountOftsname is showing red(which is ok)

2.Least value is showing Blue(which is ok)

Problem is::

3.ANything other than  max and min  is yellow...
The value after the max(immediate after max)  is yellow which is ok  and the value after that  i.e (immediate before min)has to be green but is yellow..

its like this
CountOftsname            color
44                                 red
34                                 yellow
7                                    green
1                                     blue

The green one is the problem..i dont know how to code it..
0

LVL 28

Expert Comment

ID: 12260883
This should do it for you:

If ({osg_fbct_db_viewW_count.CountOftsname})=
Maximum ({osg_fbct_db_viewW_count.CountOftsname}, {osg_fbct_db_viewW_count.CY_CYCLE}) Then
crRed
Else
If ({osg_fbct_db_viewW_count.CountOftsname})=
Minimum ({osg_fbct_db_viewW_count.CountOftsname}, {osg_fbct_db_viewW_count.CY_CYCLE}) Then
crBlue
Else
If ({osg_fbct_db_viewW_count.CountOftsname})=
NthLargest(2,{osg_fbct_db_viewW_count.CountOftsname}, {osg_fbct_db_viewW_count.CY_CYCLE}) Then
crYellow
If ({osg_fbct_db_viewW_count.CountOftsname})=
NthLargest(3,{osg_fbct_db_viewW_count.CountOftsname}, {osg_fbct_db_viewW_count.CY_CYCLE}) Then
crGreen
Else
DefaultAttribute
0

LVL 28

Expert Comment

ID: 12437411
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
###### Suggested Courses
Course of the Month11 days, 16 hours left to enroll