Focal Point
[SOLVED] Conditionally styling 3 value range (Traffic light)

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/9947078196

October 24, 2019, 05:05 PM
Joel Elscott
[SOLVED] Conditionally styling 3 value range (Traffic light)
I'm having issues conditionally styling 3 value ranges (red/yellow/green).

What am I missing here? I would have expected any value less than 12,000 to be Red.

TABLE FILE CAR
SUM
CAR.BODY.SALES
BY CAR.COMP.CAR
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/warm.sty,
$
DEFMACRO=GREEN,
MACTYPE=RULE,
WHEN=N2 GE 30000,
$
DEFMACRO=YELLOW,
MACTYPE=RULE,
WHEN=N2 LT 30000,
$
DEFMACRO=RED,
MACTYPE=RULE,
WHEN=N2 LE 12000,
$
TYPE=DATA,
COLUMN=N2,
COLOR='GREEN',
MACRO=GREEN,
$
TYPE=DATA,
COLUMN=N2,
COLOR='YELLOW',
MACRO=YELLOW,
$
TYPE=DATA,
COLUMN=N2,
COLOR='RED',
MACRO=RED,
$
ENDSTYLE
END

This message has been edited. Last edited by: Joel Elscott,


WebFOCUS 8.2.03
z/OS
October 25, 2019, 04:50 AM
Tony A
Try changing the order of the TYPE=DATA styling as the order gives precedence -

TYPE=DATA,
COLUMN=N2,
COLOR='GREEN',
MACRO=GREEN,
$
TYPE=DATA,
COLUMN=N2,
COLOR='RED',
MACRO=RED,
$
TYPE=DATA,
COLUMN=N2,
COLOR='YELLOW',
MACRO=YELLOW,
$


T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
October 25, 2019, 08:50 AM
Joel Elscott
I've tried messing with the orders as well. In your example nothing turns yellow Frowner


WebFOCUS 8.2.03
z/OS
October 25, 2019, 09:24 AM
pav
Try this.
 
TABLE FILE CAR
SUM
CAR.BODY.SALES
BY CAR.COMP.CAR
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/warm.sty,
$
-*DEFMACRO=GREEN,
-*MACTYPE=RULE,
-*WHEN=N2 GE 30000,
-*$
-*DEFMACRO=YELLOW,
-*MACTYPE=RULE,
-*WHEN=N2 LT 30000,
-*$
-*DEFMACRO=RED,
-*MACTYPE=RULE,
-*WHEN=N2 LE 12000,
-*$
TYPE=DATA,
COLUMN=N2,
COLOR='GREEN',
WHEN=SALES GE 30000,
$
TYPE=DATA,
COLUMN=N2,
COLOR='YELLOW',
WHEN=SALES GT 12000,
$
TYPE=DATA,
COLUMN=N2,
COLOR='RED',
WHEN=SALES LT 12000,
$
ENDSTYLE
END

October 25, 2019, 09:34 AM
Joel Elscott
Thanks Pav, that worked! But I think there is a bug in the tool, this should work using the GUI. Glad I have a workaround though.


WebFOCUS 8.2.03
z/OS
October 25, 2019, 10:55 AM
Tony A
quote:
In your example nothing turns yellow

That's because there is no value LT 30000 and GT 12000 that would trigger the condition. There is one that is exactly 12000 but that does not fall into the conditions that you supply.

The one that Pav shows would be the better option as it utilises the ordering precedence by correctly utilising the boundaries that you set.

Notice that the (effective yellow macro) uses GT 12000 as opposed to LT 30000 that you used. To get that one line to be coloured yellow, this should really be GE 12000 and the one for red should be LT 12000.

If you were to leave your original and change these boundaries, then you should get what you wanted.

And yes, this is possible in the GUI if you carefully set your boundaries.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10