Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Highlight an item.

Status
Not open for further replies.

mudflap

MIS
Feb 14, 2002
194
CA
Is there a way to highlight an item with a formula.
So if something was do today you could tell CR to
highlight that item say a light gray?

Thanks
Peter harrison
 
Right click the field in question, and select format field. Go to the border tab, and click the X-2 button to the right of background color, and enter a formula:

If <<condition>> then silver else DefaultAttribute

This will give a silver highlight to this object if the condition evalautes to true. Software Training and Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
Go into Format Editor for the formula. Select Border, Background to get your conditional color. Click on the Formula Format Editor and enter your condition. Something like:

if {@Due} = 'Today' then Red else Blue
 
I used the above formula, works wonderfully. However, I am working with a DateValue field and when I ask it to change any records that are < 2002,03,01 it doesn't change the background color. It only effects those fields that have data in them. I need something to change 'Null' value fields to a color and leave those that are >'Null' alone.

Any more suggestions?
 
if IsNull({Datefield}) then false else if {Datefield}<date(2002,3,1) then silver.

This will leave nulls alone with respect to the conditional formatting. Software Training and Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
If you're using 8.5, you could reverse this, and just use the highlight expert.

Set the default background colour to whatever you want the null background colour to be.

Set the highlight expert to change the background colour to white where the value = 0, or is < or > 0.

When it's null, the default colour of, say, red will show through. Otherwise, the background is white.

You have to do this bass-ackwards like this, because you can't manipulate nulls in the highlight expert.

Naith
 
Scratch that stupid suggestion. It won't do squat for nulls.

Naith
 
I tried it anyway prior to getting your next post. The highlighting expert will not work with date fields, only number and currency. I tried everything. Any suggestions as far as the else if boolean requirement? I had that one somewhat working, but it was bass-ackwards, doing exactly the opposite of what I needed it to. It colored the fields with data in them.
 
The boolean problem is because I've never seen a boolean If expression with an Else If. It's just &quot;...Then True Else False&quot;. There's no point putting an Else If in a boolean because if the first criteria was False, then anything in the Else - regardless of what the Else is going to say - must be True.

Here's what I think you should do - and don't tell anyone I told you this, because I think the type of solution I'm about to give you is cheap and nasty. However, I think it's the only way you can get a null field to look like it's adopting a colour.

Move the formula in question somewhere else.

Create a formula with nothing in it except &quot; &quot;

Drop the empty formula on your report where the null date formula is going to go.

Colour the background of the empty formula the colour you want the background of the null to be.

Conditionally suppress the empty formula with:

Not IsNull({@NullDateFormulaName})

Place the null date formula exactly over the empty formula.

I think that's it.

Good luck,

Naith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top