cancel
Showing results for 
Search instead for 
Did you mean: 

Conditional Formatting (a simple example)

Former Member
0 Kudos
99

Plz forgive the simplicity of this example [I'm a CR4Eclipse newbie].

I had trouble coming up with the right date style when conditionally formatting a column based on a value in CR4Eclipse. I found a complex example, but it didn't help with the required date format, so I thought I'd post this for other newbies.

Paste the code snippet below into your Formulas tab [change the table/col names], or right-click a column in your report layout, click "Conditional Formulas...", then select Font Color from the drop-down.

HINT: If don't know what format/style to use in the conditional formula for numbers, dates, etc., try hard-coding a filter on one of your columns to figure how to get the right date style for your formula.

MYTABLEMYCOLUMN_DATE : Font Color

//

// Return the font color to use for this field.

// Return values: Color (red, green, blue), crBlack, crMaroon, crGreen, crOlive,

// crNavy,crPurple,crTeal,crSilver,crRed, crLime,crYellow,crBlue,crFuchsia,

// crAqua,crWhite,crNoColor

//

// Abbie Hoffman always said you can't trust anybody over 30, so

// font=green if date is greater than 12/01/1976 else font=red

if {MYTABLE.MYCOLUMN} >= #1976-1-1 0:0:0# then

crGreen

else

crRed

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

We're always looking for others that find "interesting" pieces of information and tips to post. Thanks for doing so! Looking forward to seeing more! :)Â

   - Kathryn Webster (Report Design Consultant)
          Kat's News: http://diamond.businessobjects.com/blog/279


Answers (0)