Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Changing background color of a cell (Field) - Crystal Report

Posted on 2012-04-02
8
Medium Priority
?
3,704 Views
Last Modified: 2012-06-27
Hi,

I have two columns:

Column_Value            Column_Display
          1                                  W
          2                                  W
                                              Y
                                              Y

Whenever the value of the column "Column_Display" = "Y" then i want to display the background color of the "Column_Value" cell in "Yellow" color otherwise in "White" color.

Note that for the column "Column_Display" there may or may not be a corresponding value existing in "Column_Value". Can you please provide me the steps to do this task ?

Thanks
0
Comment
Question by:milani_lucie
[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
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 13

Assisted Solution

by:Ashok
Ashok earned 1000 total points
ID: 37797363
Try

Step #1 : Right-click on the field Column_Value and select Format Field.
Step #2 : Click on the "Font" tab.
Step #3 : Click on the "x-2" (formula) button next to BackgroundColor.
Step #4 : Use the following fomula: if Column_Display = "Y" then crYellow else crWhite
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 37797369
Try this

Assumes this is the details so the values are in the same record.

Right click the field
Click FORMAT FIELD
Click the BORDER tab
Click the formula button to the right of BACKGROUND

If {Column_DisplayField} = 'Y' then
    crYellow
Else
    crWhite

mlmcc
0
 

Author Comment

by:milani_lucie
ID: 37797376
I have tried in that way. But it is not working as expected.

Thanks
0
Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

 

Author Comment

by:milani_lucie
ID: 37797382
Background color is not working for rows 3 and 4.

Thanks
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 37797530
Is the field NULL?
If so you will have to use a formula for the field so the report puts something there

Something like


If IsNull({ColumnField}) then
   ' '
Else
   {ColumnFIeld}

mlmcc
0
 

Author Comment

by:milani_lucie
ID: 37797692
Its EMPTY string in both the rows which is coming from the database.

Thanks
0
 

Author Comment

by:milani_lucie
ID: 37797695
For Column_Value - Thanks
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 1000 total points
ID: 37799118
You can try

If IsNull({ColumnField}) OR {ColumnField} = "" then
   '  '
Else
   {ColumnFIeld}

FOrthe formatting to work you hav eto get the field to put something in the field.  Null or empty string won't trigger the formatting

mlmcc
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

604 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