Focal Point
Stylesheet data output with alternate backcolor

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

May 10, 2005, 06:28 PM
<Nathan>
Stylesheet data output with alternate backcolor
Is there a easy way in webfocus internal
stylesheet or otherwise, so output rows
of data will be shown in alternate background
colors ?

Thanks
May 10, 2005, 06:39 PM
Boogarweed
Yes, I code it by hand in the following manner. Put the code below in the PRINT statement.

COMPUTE COUNTER/I6 = COUNTER + 1; NOPRINT
COMPUTE EVENORODD/I1 = IMOD ( COUNTER , 2 , EVENORODD ); NOPRINT


Then in the style sheet put this:

TYPE=DATA, BACKCOLOR=WHITE, WHEN=EVENORODD EQ 0, $
TYPE=DATA, BACKCOLOR=RGB(245 245 245), WHEN=EVENORODD EQ 1, $

I use white and RGB(245 245 245) (White Smoke) as the alternating colors because I think they look good but you can use any colors you like.
May 10, 2005, 07:11 PM
Lenny Ward
This would make the background color of the first line white and the next line gray.

TYPE=DATA, BACKCOLOR=( 'WHITE' RGB(231 231 231) ), $


Lenny
May 10, 2005, 10:48 PM
susannah
you can even color chunks of rows , say when a byvalue changes, using this WHEN= technique, all depends how you set up your key. very cool and flexible.
i set up my colors as &vars and load a color palette.
-INCLUDE COLORS1
..fex goes here
TYPE=DATA,COLOR=&RGBALTROW,WHEN=KEY1 EQ 1,$
and for each app i might load a different color palette (COLORS1.fex) to set the &var &RGBALTROW
so in the colors1.fex
-SET &RGBALTROW = 'RGB(245 245 245)';
and lots more colors..
so for one application, &rgbaltrow might be grey
and for another, &rgbaltrow might be pale blue.
same fex, different colors.
just an idea.
May 10, 2005, 11:52 PM
<Nathan>
Thanks Boogarweed, Lenny Ward and Susannah
for the help.

For this particular problem, I went ahead
with Lenny Ward's solution, which worked
fine.

Thanks
January 03, 2006, 10:52 AM
S.J. Kadish
Minor twist on this one, which is great to know:

how would the computes be changed to shade two lines with backcolor white, two lines with some other backcolor?

Happy New Year!


Sandy Kadish
Dev: 8.2.04- PostgreSQL
Test: 8.2.04 - PostgreSQL
Prod: 8.2.04 - PostgreSQL
January 03, 2006, 11:37 AM
Tony A
Hi Sandy,

You could achieve it by
    COMPUTE COUNTER/I6 = COUNTER + 1; NOPRINT
    COMPUTE EVENORODD/I2 = (IMOD ( COUNTER + 1 , 4 , EVENORODD )); NOPRINT
TYPE=DATA, BACKCOLOR=WHITE, WHEN=EVENORODD LE 1, $
TYPE=DATA, BACKCOLOR=RGB(210 210 210), WHEN=EVENORODD GE 2, $


Regards

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 
January 03, 2006, 12:20 PM
susannah
quote:
TYPE=DATA, BACKCOLOR=( 'WHITE' RGB(231 231 231) ), $

Lenny! thats so cool
it works
its so easy
wow
thanks
how in the world did you figure that out?




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
January 03, 2006, 12:40 PM
S.J. Kadish
Tony A - Thanks! works like a charm!


Sandy Kadish
Dev: 8.2.04- PostgreSQL
Test: 8.2.04 - PostgreSQL
Prod: 8.2.04 - PostgreSQL
January 03, 2006, 12:49 PM
mgrackin
FYI, You can do this on based a BY phrase as well and you can use more than two colors.

TABLE FILE CAR
PRINT RCOST DCOST
BY COUNTRY
BY CAR
ON TABLE SET BYDISPLAY ON
ON TABLE SET STYLE *
TYPE=REPORT, COLOR=NAVY, STYLE=BOLD,$
TYPE=DATA, BACKCOLOR=(BY=COUNTRY TEAL YELLOW GOLD),$
ENDSTYLE
END


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
January 03, 2006, 01:48 PM
Francis Mariani
Sandy,

You can do it this way as well:

TYPE=DATA, BACKCOLOR=( BLUE BLUE WHITE WHITE ), $


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
January 03, 2006, 02:43 PM
Lenny Ward
I looked in the IBI doc's to find out about alternating background color but could not find it.

I think I found out about it:
BACKCOLOR=( 'WHITE' 'YELLOW' 'LIME' RGB(204 255 255) ),

awhile back by playing around with DevStudio.

The 7.1.3 beta DevStudio allows you to specify 4 alternating colors. You might be able to have more.

Lenny


(Production: WebFOCUS 7.1.3 on Win 2K/IIS 6/CGI)
(Test: WebFOCUS 7.1.3 on Win 2K/IIS 6/CGI)
January 06, 2006, 04:21 PM
<RickW>
Just to add another twist on the same thing...

You can also use LIST and then use Boogardweeds method using the E01 alias. You need to make sure your data is already sorted before you use LIST though.

TABLEF FILE CAR
LIST CAR
ON TABLE HOLD
END
-RUN
TABLE FILE HOLD
PRINT CAR
AND COMPUTE BAND1/I1=IF (IMOD(E01, 2, 'I6') NE 0) THEN 0 ELSE 1; NOPRINT
ON TABLE SET ONLINE-FMT PDF
ON TABLE SET STYLE *
TYPE=DATA, BACKCOLOR=RGB(225 229 229), WHEN=BAND1 EQ 0,$
ENDSTYLE
END

Nothing like flexibility Wink
January 08, 2006, 02:08 PM
Steve C
You are over complicating this! There is a feature in the STYLESHEET that lets you color alternating rows with a single command:

TYPE=DATA,
FONT='ARIAL',
COLOR='BLACK',
BACKCOLOR=( 'WHITE' RGB(255 255 224) ),
TOPGAP=0.013889,
BOTTOMGAP=0.027778,
JUSTIFY=RIGHT,
$
The BACKCOLOR attribute is just set to the alternating colors you want, the rest is automatic.


Steve