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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional Styling

Status
Not open for further replies.

kaeserea

Programmer
Feb 26, 2003
164
DE
Hello,

I'd like to color some fields in my report. The cells of one column (MYFIELD in the example below) should be green, yellow, red depening on the value they contain:

value <= 5 : green
value > 5.01 and < 7.5 : yellow
value >= 7.5 : red

I did the red and green like this:

[tt]
DEFMACRO=COND0001, MACTYPE=RULE, WHEN=MYFIELD LE 5, $
DEFMACRO=COND0003, MACTYPE=RULE, WHEN=MYFIELD GE 7.5, $

TYPE=DATA, JUSTIFY=RIGHT, MACRO=COND0001, COLUMN=MYFIELD, BACKCOLOR=GREEN, $
TYPE=DATA, JUSTIFY=RIGHT, MACRO=COND0003, COLUMN=MYFIELD, BACKCOLOR=RED, $
[/tt]

This works fine. Yet I have a problem with the yellow condition. I want the value of MYFIELD to be between two numbers. I tried to simply add

[tt]
DEFMACRO=COND0002, MACTYPE=RULE, WHEN=ARCKST GT 5.01, $

TYPE=DATA, JUSTIFY=RIGHT, MACRO=COND0002, COLUMN=MYFIELD, BACKCOLOR=YELLOW, $
[/tt]

or this:

[tt]
DEFMACRO=COND0002, MACTYPE=RULE, WHEN=ARCKST GT 5.01 AND LT 7.5, $

TYPE=DATA, JUSTIFY=RIGHT, MACRO=COND0002, COLUMN=MYFIELD, BACKCOLOR=YELLOW, $

[/tt]

But neither worked. Can anybody tell me how to do it right?

Thanx a lot,
Eva
 
Actually, a range can be done by specifying a conditional phrase for BOTH ends of the range separately. In the manual, there's an example:

Code:
TYPE=DATA, BACKCOLOR=AQUA, STYLE=BOLD+ITALIC,
WHEN=LINEPRICE GT 500000,$

TYPE=DATA, BACKCOLOR=YELLOW, STYLE=BOLD,
WHEN=LINEPRICE GT 400000,$

which says, in the note:

The first conditional declaration formats any rows whose order total is greater than 500,000.

The second conditional declaration formats any rows whose order toal is greater than 400,000 and less than or equal to 500,000.

This is on page 24-8 of the 7.1 WebFOCUS Creating Reports manual.
 
Thanx, works! I simply overlooked the order of the statements.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top