Focal Point
[CLOSED] Multiple Conditions for Traffic Light Formatting

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

October 06, 2015, 12:01 PM
Angelo Spaziani
[CLOSED] Multiple Conditions for Traffic Light Formatting
Is there a method of applying multiple conditions to the traffic light formatting rules? For example, i want to highlight a cell if it satisfies RULE1 (X>10) AND RULE2(Y<10).

This message has been edited. Last edited by: <Kathryn Henning>,


8103
Server 2012
October 06, 2015, 12:34 PM
GavinL
You must create a define with multi-conditions.

ENGINE INT CACHE SET ON

-DEFAULTH &WF_SUMMARY='Summary';
-DEFAULTH &WF_TITLE='WebFOCUS Report';

DEFINE FILE ibisamp/car
ISRED/I1 = IF SALES GT 0 AND SALES LT 8000 THEN 1 ELSE 0;
ISGREEN/I1 = IF SALES GT 8000 THEN 1 ELSE 0;
END

TABLE FILE ibisamp/car
SUM CAR.BODY.SALES
BY CAR.ORIGIN.COUNTRY
BY CAR.COMP.CAR
BY ISRED NOPRINT
BY ISGREEN NOPRINT
ON TABLE PCHOLD FORMAT HTML
ON TABLE NOTOTAL
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET SQUEEZE ON
ON TABLE SET EMPTYREPORT ON
ON TABLE SET HTMLCSS ON
ON TABLE SET HTMLENCODE ON
ON TABLE SET CACHELINES 100
ON TABLE SET GRWIDTH 1
ON TABLE SET STYLE *
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/ENIADefault_combine.sty,$
DEFMACRO=Condition_1, MACTYPE=RULE, WHEN=ISRED EQ 1, $
DEFMACRO=Condition_2, MACTYPE=RULE, WHEN=ISGREEN EQ 1, $
TYPE=REPORT, TITLETEXT='WebFOCUS Report', SUMMARY='Summary', $
TYPE=DATA, COLUMN=SALES, MACRO=Condition_1, FONT='Trebuchet MS', BACKCOLOR=RGB(255 0 0), $
TYPE=DATA, COLUMN=SALES, MACRO=Condition_2, FONT='Trebuchet MS', BACKCOLOR=RGB(0 255 0), $
ENDSTYLE
END

-RUN




- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
October 06, 2015, 04:57 PM
Waz
Gavin,

Its nice to see DEFMACRO still being used.

Its too easy to just code the WHEN.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

October 07, 2015, 03:58 AM
Dave
@Waz

That's because the GUI does it with DEFMACRO.

I didn't even know WHEN could also be used. It isn't documented ( anymore ).


_____________________
WF: 8.0.0.9 > going 8.2.0.5
October 07, 2015, 04:04 AM
Waz
I've go so used to adding WHEN in that we have replicated conditions, where we could have the DEFMACRO set up.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

October 07, 2015, 09:16 AM
GavinL
quote:
Its nice to see DEFMACRO still being used.

Its too easy to just code the WHEN.


I did this in InfoAssist, then added the define at the code level. However, I'm always in a learning mode, so please show me how you would do it.



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
October 07, 2015, 05:05 PM
Waz
DEFMACRO=Condition_1, MACTYPE=RULE, WHEN=ISRED EQ 1, $
DEFMACRO=Condition_2, MACTYPE=RULE, WHEN=ISGREEN EQ 1, $
TYPE=REPORT, TITLETEXT='WebFOCUS Report', SUMMARY='Summary', $
TYPE=DATA, COLUMN=SALES, MACRO=Condition_1, FONT='Trebuchet MS', BACKCOLOR=RGB(255 0 0), $
TYPE=DATA, COLUMN=SALES, MACRO=Condition_2, FONT='Trebuchet MS', BACKCOLOR=RGB(0 255 0), $


TYPE=REPORT, TITLETEXT='WebFOCUS Report', SUMMARY='Summary', $
TYPE=DATA, COLUMN=SALES, WHEN=ISRED EQ 1, FONT='Trebuchet MS', BACKCOLOR=RGB(255 0 0), $
TYPE=DATA, COLUMN=SALES, WHEN=ISGREEN EQ 1, FONT='Trebuchet MS', BACKCOLOR=RGB(0 255 0), $



Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

October 08, 2015, 08:07 AM
GavinL
I didn't know you can put a WHEN within a TYPE clause. Good One

Guess that is why your an expert and I'm just a guru. Big Grin



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
October 08, 2015, 05:06 PM
Waz
I always wanted to be a Guru, but got past it.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

October 12, 2015, 01:27 PM
GavinL
I've just schooled on why use defmacro over WHEN within the TYPE.

If you have multiple columns that you need the same condition, then using a macro there is only one line to change instead of all the columns that are affected.





- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server