Focal Point
[Case Opened] Conditionally Override a Style - Active Report.

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

June 22, 2015, 02:04 PM
David Briars
[Case Opened] Conditionally Override a Style - Active Report.
When I run the following report...
TABLE FILE GGSALES
PRINT   SEQ_NO
        ST
        DOLLARS
COMPUTE FLAG1/A20 = IF SEQ_NO EQ 1 OR 3 THEN 'GREEN' ELSE 'BLUE';
COMPUTE FLAG2/A20 = IF ST EQ 'MA' THEN 'RED' ELSE FLAG1;
-*
IF SEQ_NO LE 4
-*
ON TABLE PCHOLD FORMAT AHTML
ON TABLE SET HTMLCSS ON
ON TABLE SET LINES 30
ON TABLE SET PAGE NOPAGE
ON TABLE SET STYLE *
 TYPE=DATA, BACKCOLOR = 'GREEN',            WHEN = FLAG1 EQ 'GREEN',$
 TYPE=DATA, BACKCOLOR = 'BLUE',             WHEN = FLAG1 EQ 'BLUE',$
 TYPE=DATA, COLUMN = ST, BACKCOLOR = 'RED', WHEN = FLAG2 EQ 'RED', $
ENDSTYLE
END
-EXIT  

...I see alternating green and blue background colors.

The 'cell' with 'MA' does not have a 'red' background. Although I think I should be able to override the background color.

When I change the FORMAT to HTML, indeed I do see the 'red' background for 'MA'.

Any ideas, on what I am doing wrong, or what I can to to make AHTML behave as nicely as HTML?

This message has been edited. Last edited by: David Briars,




Pilot: WebFOCUS 8.2.06 Test: WebFOCUS 8.1.05M Prod: WebFOCUS 8.1.05M Server: Windows Server 2016/Tomcat Standalone Workstation: Windows 10/IE11+Edge Database: Oracle 12c, Netezza, & MS SQL Server 2019 Output: AHTML/XLSX/HTML/PDF/JSCHART Tools: WFDS, Repository Content, BI Portal Designer & ReportCaster
June 22, 2015, 02:42 PM
MartinY
This does it
TABLE FILE GGSALES
PRINT   SEQ_NO
        ST
        DOLLARS
COMPUTE FLAG1/A20 = IF SEQ_NO EQ 1 OR 3 THEN 'GREEN' ELSE 'BLUE';
COMPUTE FLAG2/A20 = IF ST EQ 'MA' THEN 'RED' ELSE FLAG1;
-*
-*IF SEQ_NO LE 4
-*
ON TABLE PCHOLD FORMAT AHTML
ON TABLE SET HTMLCSS ON
ON TABLE SET LINES 30
ON TABLE SET PAGE NOPAGE
ON TABLE SET STYLE *
TYPE=DATA,
     BACKCOLOR=( 'GREEN' 'BLUE' ),
$
 TYPE=DATA, COLUMN = ST, BACKCOLOR = 'RED', WHEN = FLAG2 EQ 'RED', $
ENDSTYLE
END


With the benefit that every 'MA' is displayed in red background.

And if you invert the color, the color order assignation will be inverted to
     BACKCOLOR=( 'BLUE' 'GREEM' ),

This message has been edited. Last edited by: MartinY,


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
June 22, 2015, 02:50 PM
David Briars
Thanks Martin!

In my case, I am really alternating colors with 'groups' of rows, not every other row, so I cannot use the 'alternating row' StyleSheet syntax.

Here is my scenario, showing the first two rows are green and then the next two rows are blue.

TABLE FILE GGSALES
PRINT   SEQ_NO
        ST
        DOLLARS
COMPUTE FLAG1/A20 = IF SEQ_NO EQ 1 OR 2 THEN 'GREEN' ELSE 'BLUE';
COMPUTE FLAG2/A20 = IF ST EQ 'MA' THEN 'RED' ELSE FLAG1;
-*
IF SEQ_NO LE 4
-*
ON TABLE PCHOLD FORMAT AHTML
ON TABLE SET HTMLCSS ON
ON TABLE SET LINES 30
ON TABLE SET PAGE NOPAGE
ON TABLE SET STYLE *
 TYPE=DATA, BACKCOLOR = 'GREEN',            WHEN = FLAG1 EQ 'GREEN',$
 TYPE=DATA, BACKCOLOR = 'BLUE',             WHEN = FLAG1 EQ 'BLUE',$
 TYPE=DATA, COLUMN = ST, BACKCOLOR = 'RED', WHEN = FLAG2 EQ 'RED', $
ENDSTYLE
END
-EXIT





Pilot: WebFOCUS 8.2.06 Test: WebFOCUS 8.1.05M Prod: WebFOCUS 8.1.05M Server: Windows Server 2016/Tomcat Standalone Workstation: Windows 10/IE11+Edge Database: Oracle 12c, Netezza, & MS SQL Server 2019 Output: AHTML/XLSX/HTML/PDF/JSCHART Tools: WFDS, Repository Content, BI Portal Designer & ReportCaster
June 22, 2015, 02:55 PM
MartinY
Huummm...

Able to change font color but not backcolor....

I know that there are several "issue/restrictions" with AHTML styling but can't find it.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
June 22, 2015, 03:12 PM
MartinY
Got it !

Have to code every column which is not the best, but it works
TABLE FILE GGSALES
PRINT   SEQ_NO
        ST
        DOLLARS
COMPUTE FLAG1/A20 = IF SEQ_NO EQ 1 OR 2 THEN 'GREEN' ELSE IF SEQ_NO LE 4 THEN 'BLUE' ELSE '';
COMPUTE FLAG2/A20 = IF ST EQ 'MA' THEN 'RED' ELSE FLAG1;
-*
-*IF SEQ_NO LE 4
-*
ON TABLE PCHOLD FORMAT AHTML
ON TABLE SET HTMLCSS ON
ON TABLE SET LINES 30
ON TABLE SET PAGE NOPAGE
ON TABLE SET STYLE *
-*
-*     DEFMACRO=LINE12,
-*     MACTYPE=RULE,
-*     WHEN=FLAG1 EQ 'GREEN',
-*$
-*     DEFMACRO=LINE34,
-*     MACTYPE=RULE,
-*     WHEN=FLAG1 EQ 'BLUE',
-*$
-*     DEFMACRO=DSPRED,
-*     MACTYPE=RULE,
-*     WHEN=FLAG2 EQ 'RED',
-*$
-*
-*TYPE=DATA, COLUMN = SEQ_NO,  BACKCOLOR = 'GREEN', MACRO = LINE12, $
-*TYPE=DATA, COLUMN = ST,      BACKCOLOR = 'GREEN', MACRO = LINE12, $
-*TYPE=DATA, COLUMN = DOLLARS, BACKCOLOR = 'GREEN', MACRO = LINE12, $
-*TYPE=DATA, COLUMN = FLAG1,   BACKCOLOR = 'GREEN', MACRO = LINE12, $
-*TYPE=DATA, COLUMN = FLAG2,   BACKCOLOR = 'GREEN', MACRO = LINE12, $
-*
-*TYPE=DATA, COLUMN = SEQ_NO,  BACKCOLOR = 'BLUE',  MACRO = LINE34, $
-*TYPE=DATA, COLUMN = ST,      BACKCOLOR = 'BLUE',  MACRO = LINE34, $
-*TYPE=DATA, COLUMN = DOLLARS, BACKCOLOR = 'BLUE',  MACRO = LINE34, $
-*TYPE=DATA, COLUMN = FLAG1,   BACKCOLOR = 'BLUE',  MACRO = LINE34, $
-*TYPE=DATA, COLUMN = FLAG2,   BACKCOLOR = 'BLUE',  MACRO = LINE34, $
-*
-*TYPE=DATA, COLUMN = ST, BACKCOLOR = 'RED', MACRO = DSPRED, $


TYPE=DATA, COLUMN = SEQ_NO,  BACKCOLOR = 'GREEN', WHEN = FLAG1 EQ 'GREEN',$
TYPE=DATA, COLUMN = ST,      BACKCOLOR = 'GREEN', WHEN = FLAG1 EQ 'GREEN',$
TYPE=DATA, COLUMN = DOLLARS, BACKCOLOR = 'GREEN', WHEN = FLAG1 EQ 'GREEN',$
TYPE=DATA, COLUMN = FLAG1,   BACKCOLOR = 'GREEN', WHEN = FLAG1 EQ 'GREEN',$
TYPE=DATA, COLUMN = FLAG2,   BACKCOLOR = 'GREEN', WHEN = FLAG1 EQ 'GREEN',$

TYPE=DATA, COLUMN = SEQ_NO,  BACKCOLOR = 'BLUE',  WHEN = FLAG1 EQ 'BLUE',$
TYPE=DATA, COLUMN = ST,      BACKCOLOR = 'BLUE',  WHEN = FLAG1 EQ 'BLUE',$
TYPE=DATA, COLUMN = DOLLARS, BACKCOLOR = 'BLUE',  WHEN = FLAG1 EQ 'BLUE',$
TYPE=DATA, COLUMN = FLAG1,   BACKCOLOR = 'BLUE',  WHEN = FLAG1 EQ 'BLUE',$
TYPE=DATA, COLUMN = FLAG2,   BACKCOLOR = 'BLUE',  WHEN = FLAG1 EQ 'BLUE',$

TYPE=DATA, COLUMN = ST, BACKCOLOR = 'RED',WHEN = FLAG2 EQ 'RED',$
ENDSTYLE
END

Personally, I prefer with the "MACRO" coding; less places to changes if the condition change :-)

This message has been edited. Last edited by: MartinY,


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
June 22, 2015, 03:16 PM
David Briars
Thanks again Martin.

Yep, it is funny (apologies to Joe Pesci) that 'font' is respected, but not background color.

Yep(2), we saw we could style every column...hoping to avoid that though.

This message has been edited. Last edited by: David Briars,
June 22, 2015, 03:27 PM
MartinY
It seems that you won't have choices to code them all... Big Grin


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
June 22, 2015, 05:24 PM
David Briars
Case opened.