Solved

How do I prioritizing conditional formatting in crystal reports?

Posted on 2009-05-18
10
333 Views
Last Modified: 2013-11-28
I'm setting up conditional formatting for a report and they conflict. I can not use any other color for this but red and white so changing the colour to something else is not an option.

I want to apply both the formats to the whole report but for the country Canada if there are orders under $100 (and there are) then the font is the same colour as the background and I can't have that. Is there an override/priority order or something I can write that says if the background is red ignore the color change? I know how to prioritize in highlight expert but highlight expert does not display conditional formatting as far as I know and also I know I can do this in highlight expert but I need to know how to do it in conditional formatting.

Thanks!!

edit: just a note I'm using Crystal Reports 2008 Developer (version 12)
// This is to change the font colour of the order amount if the amount is less than 100

if {Orders.Order Amount} < 100

then 

    red

else

    white

 

// This is to change the background colour of the details if the country is Canada

if {Customer.Country} = "Canada"

then

    red

else

    white

Open in new window

0
Comment
Question by:respawn
  • 5
  • 3
  • 2
10 Comments
 
LVL 2

Expert Comment

by:vetaldj
ID: 24416612
You can try something like this
// This is to change the font colour of the order amount if the amount is less than 100

if {Orders.Order Amount} < 100 and {Customer.Country} <> "Canada" 

then 

    red

else

    white

 

// This is to change the background colour of the details if the country is Canada

if {Customer.Country} = "Canada"

then

    red

else

    white

Open in new window

0
 

Author Comment

by:respawn
ID: 24416688
Also I just noticed that if the background is white and the order is above 100 the font is white as well so that doesn't show up. So just to recap I need something like

if {Customer.Country} = "Canada" and {Orders.Order Amount} < (less than) 100
then
    details background white
    font red

if {Customer.Country} = "Canada" and {Orders.Order Amount} > (greater than) 100
then
    details background red
    font white

if {Customer.Country} (not equal) "Canada" and {Orders.Order Amount} < (less than) 100
then
    details background white
    font red

if {Customer.Country} (not equal) "Canada" and {Orders.Order Amount} < (greater than) 100
then
    details background white
    font black



0
 
LVL 100

Expert Comment

by:mlmcc
ID: 24416725
There is no prioritizing.

Do that in the appripriate places.
Detail background
if {Customer.Country} = "Canada" and {Orders.Order Amount} < (less than) 100
then
    crWhite
else if {Customer.Country} = "Canada" and {Orders.Order Amount} > (greater than) 100
then
    crRed
if {Customer.Country} (not equal) "Canada" and {Orders.Order Amount} < (less than) 100
then
    crWhite
else if {Customer.Country} (not equal) "Canada" and {Orders.Order Amount} < (greater than) 100
then
    crWhite

Similarly for the font color

mlmcc
0
 

Author Comment

by:respawn
ID: 24417305
So I need to put the full above into both places? Also I know = is equals but what is the sign for not equals? Thanks
0
 

Author Comment

by:respawn
ID: 24417350
nvm I found what not equals is, i figured I just could have googled it.  Anyhow, I'm quite new to formulas, I tried to format the text but I got an error and am unsure how to fix it. I have attached what I got. Think you can help? Thanks.
formula.png
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 100

Expert Comment

by:mlmcc
ID: 24417396
My fault.  Need an ELSE before the third IF

mlmcc
0
 

Author Comment

by:respawn
ID: 24418296
well i put in the formula like you said and I put it in both places and I removed the highlight expert rules and I got what you see in the image below. I'm really not sure what to do lol.
hrmm.png
0
 
LVL 2

Accepted Solution

by:
vetaldj earned 500 total points
ID: 24418521
Try for font this formula:
Select {Customer.Country}
    Case "Canada":
        If {Customer.Order Amount} <= 100 Then crRed Else crWhite
    Default:
        If {Customer.Order Amount} <= 100 Then crRed Else crBlack

And for background:
Select {Customer.Country}
    Case "Canada":
        If {Customer.Order Amount} <= 100 Then crWhite Else crRed
    Default:
        crWhite

After all it looks somethig like attached file
0
 
LVL 2

Expert Comment

by:vetaldj
ID: 24418573
Can't upload file in some reason...
0
 

Author Comment

by:respawn
ID: 24426971
I changed the code to this to reflect the DB's tables and it really looks like it worked. THANKS!!!!!!

Background...

Select {Customer.Country}
    Case "Canada":
        If {Orders.Order Amount} <= 100 Then crWhite Else crRed
    Default:
        crWhite

Font...

Select {Customer.Country}
    Case "Canada":
        If {Orders.Order Amount} <= 100 Then crRed Else crWhite
    Default:
        If {Orders.Order Amount} <= 100 Then crRed Else crBlack


woot.png
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Hi, In my previous Article  (http://www.experts-exchange.com/Database/Reporting/A_15199-Introduction-to-Microstrategy.html)I discussed some basic understanding of Microstrategy that how we can get in Intro of Microstrategy (MSTR). Now it's tim…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now