[CLOSED] Conditional background color in acrossvalue
Hello, I am creating a report in 5.2.5 and would like to change the background color of an alphanumeric acrossvalue based on the text in it. Here is a faulty snippet that only works the way I would like with certain data:
What I want to do is have the bkg color be red if the value of the data in it is 'RED', or orange if the data is 'ORANGE', etc. Is this possible, and if so, how?
Thanks in advance.This message has been edited. Last edited by: Kerry,
June 10, 2004, 05:21 PM
susannah
I second the motion! we've asked for that feature. The only way now is the hard way. doing it by hand coding and specific references. This way, of course, won't work, if your across values vary in content. So you could open a case in TechSupport, that will encourage programming to fix this.
June 10, 2004, 09:40 PM
Stan
I believe you can just add the statement WHERE FIELDNAME=RED, into your logic and it would turn the font color red for those. You would have to do a line for each color that you want, however.
For example. TYPE=ACROSSVALUE,COLUMN=N3, WHERE FIELDNAME='RED', BACKCOLOR='RED',STYLE=BOLD,$ TYPE=ACROSSVALUE,COLUMN=NE, WHERE FIELDNAME='ORANGE', BACKCOLOR='ORANGE',STYLE=BOLD, $
June 14, 2004, 03:30 PM
<Pietro De Santis>
The code should use WHEN not WHERE:
TYPE=ACROSSVALUE,COLUMN=N3, WHEN FIELDNAME='RED', BACKCOLOR='RED',STYLE=BOLD,$ TYPE=ACROSSVALUE,COLUMN=NE, WHEN FIELDNAME='ORANGE', BACKCOLOR='ORANGE',STYLE=BOLD, $
Still don't know if this would work.This message has been edited. Last edited by: <Mabel>,
IF this feature did in fact work, WHICH IT DOES NOT, YET, then 'when' syntax would be as above, 'WHEN=ORDER EQ 9' ... not ... 'WHEN ORDER = 9' However, ibi's brian carter has promised to escalate this oft-requested patch.
July 27, 2007, 11:25 AM
mpb
Is conditional background color in acrossvalues available yet? mpb
This works...but I don't know what release your are on...please update your signiture...and good going for searching for the answer first.
In Focus since 1993. WebFOCUS 7.7.03 Win 2003
July 27, 2007, 02:01 PM
mgrackin
I have a report that has an ACROSS the colors the background dynamically. It applies the condition for every row/column. Is this what you are trying to do or are you wanting to do format a specific column only?
Thanks!
Mickey
FOCUS/WebFOCUS 1990 - 2011
July 30, 2007, 11:07 AM
Francis Mariani
I just cannot understand why this minimalist code doesn't work:
TABLE FILE CAR
SUM
SALES
BY COUNTRY
ACROSS SEATS
ON TABLE SET STYLESHEET *
TYPE=REPORT, ACROSSCOLUMN=SALES, BACKCOLOR=SILVER, WHEN= SEATS EQ 4,$
END
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
August 19, 2011, 10:35 AM
Emily Lee
Hi,
I need conditional bacground color when using ACROSS and OVER comand to assign color to specific ACROSSVALUE. The ACORSSVALUE are shown at the title area, not the data area.
The solution from the previous case (Case: 91541116 ) did help me of counting the column when using ACROSS with multiple OVER phrases. I need to assign color to a specific ACROSSVALUE such as when it is JAPAN or ITALY, but the COLUMN number of those in my report various from time to time. How do I get it to work without using the COLUMN=N1 technique?
Here is the solution provided by Case: 91541116:
TABLE FILE CAR SUM SALES OVER SEATS OVER DCOST ACROSS COUNTRY ON TABLE SET STYLE * TYPE=ACROSSVALUE,COLUMN=N10,COLOR=YELLOW,$ TYPE=ACROSSVALUE,COLUMN=N7,COLOR=RED,$ END
I am using 7.6.11. thanks,
WebFOCUS 8.2.01 AppStudio HTML, PDF, Excel
August 19, 2011, 11:39 AM
Tony A
Emily,
This is not the tech support site so quoting case numbers is not useful because only people registered on the tech support site with the site code used to raise the case would be able to see it (generally).
However, taking what I think your need is, try this approach -
TABLE FILE CAR
SUM SALES
OVER SEATS
OVER DCOST
OVER COMPUTE MYFLAG/A10 = COUNTRY; NOPRINT
ACROSS COUNTRY
ON TABLE SET HTMLCSS ON
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
TYPE=DATA, WHEN=MYFLAG EQ 'ENGLAND', ACROSSCOLUMN=N1, BACKCOLOR=YELLOW, $
TYPE=DATA, WHEN=MYFLAG EQ 'W GERMANY', ACROSSCOLUMN=N1, BACKCOLOR=RED, $
TYPE=DATA, WHEN=MYFLAG EQ 'JAPAN', ACROSSCOLUMN=N2, BACKCOLOR=BLUE, $
TYPE=DATA, WHEN=MYFLAG EQ 'FRANCE', ACROSSCOLUMN=N2, BACKCOLOR=AQUA, $
END
Instead of trying to trap the ACROSSVALUE I am associating it with each column individually by placing into a hidden cell of MYFLAG.
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
August 19, 2011, 02:16 PM
Emily Lee
Tony, Thanks for your suggestion. But your code give color to the data cell inside the table. My request is to get color at the column title section - for the word "JAPAN". I was also suggested to use 'ASNAMES =ON', however, I did not get it to work.
thanks, Emily
WebFOCUS 8.2.01 AppStudio HTML, PDF, Excel
August 19, 2011, 06:07 PM
<FreSte>
Emily,
I agree with you that this should be done in an easy way with the stylesheet-syntax, but as a workaround (and HTML-only ) you could do something like this:
-Fred-
DEFINE FILE CAR
XCOUNTRY/A200 =
IF COUNTRY EQ 'JAPAN' THEN '<span style="BACKGROUND-COLOR:SILVER; COLOR:RED;">' | COUNTRY | '</span> ' ELSE
IF COUNTRY EQ 'FRANCE' THEN '<span style="BACKGROUND-COLOR:GREEN; COLOR:#FFF;">' | COUNTRY | '</span> ' ELSE
COUNTRY;
END
TABLE FILE CAR
SUM
SALES OVER
SEATS OVER
DCOST OVER
ACROSS COUNTRY NOPRINT
ACROSS XCOUNTRY AS COUNTRY
END
-RUN
August 20, 2011, 06:14 AM
Tony A
Emily,
My apologies, I obviously misunderstood what you were trying to explain.
Fred's method is probably best if you only require HTML. For anything else you'll have to think about pre-parsing the data set to ascertain column notation.
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
August 20, 2011, 06:30 AM
Tony A
Just in case you do not understand what I mean by pre-parsing, then this should help -
-DEFAULT &Rows = 3;
TABLE FILE CAR
SUM COMPUTE COUNT/P2 = IF LAST COUNT EQ 0 THEN 1 ELSE LAST COUNT + &Rows; NOPRINT
COMPUTE COLUMN_NOT/A5 = 'N' || LJUST(2,PTOA(COUNT,'(P2)','A2'),'A2'); NOPRINT
COMPUTE COUNTRY_CLR/A10 = DECODE COUNTRY ('ENGLAND' 'RED' 'FRANCE' 'YELLOW' 'ITALY' 'GREEN' 'W GERMANY' 'BLUE' ELSE 'AQUA'); NOPRINT
COMPUTE STYLE_LINE/A80 = 'TYPE=ACROSSVALUE,COLUMN='||COLUMN_NOT||',BACKCOLOR='||COUNTRY_CLR||',$';
BY COUNTRY NOPRINT
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE SAVE AS STYLEFEX FORMAT ALPHA
END
-RUN
TABLE FILE CAR
SUM SALES
OVER SEATS
OVER DCOST
ACROSS COUNTRY
ON TABLE SET STYLE *
-INCLUDE STYLEFEX
END
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
August 20, 2011, 09:38 AM
<FreSte>
Tony, Very nice technique
August 22, 2011, 12:32 AM
Dan Satchell
Try this:
TABLE FILE CAR
SUM COUNTRY
OVER SALES
OVER SEATS
OVER DCOST
ACROSS COUNTRY NOPRINT
ON TABLE SET STYLE *
TYPE=DATA, STYLE=BOLD, ACROSSCOLUMN=COUNTRY, BACKCOLOR=RED, WHEN=COUNTRY EQ 'ITALY', $
TYPE=DATA, STYLE=BOLD, ACROSSCOLUMN=COUNTRY, BACKCOLOR=YELLOW, WHEN=COUNTRY EQ 'JAPAN', $
ENDSTYLE
END
WebFOCUS 7.7.05
August 22, 2011, 11:26 AM
Emily Lee
FreSte, Tony and Dan, Thank you all very much for your suggestions. Dan's suggestion will push the columns heading to the data section. Tony's idea is good too. My co-worker also found a solution, I would like to share with you. This solution is based on our special need - Show cloumn headings of all countries even when the country does not have data. (in the example bellowed, USA does not have data for the reporting period) Here is the code: TABLE FILE CAR SUM 'CAR.BODY.SALES' OVER 'CAR.BODY.SEATS' OVER 'CAR.BODY.DEALER_COST' ACROSS 'CAR.ORIGIN.COUNTRY' COLUMNS ENGLAND AND FRANCE AND USA AND ITALY AND JAPAN AND 'W GERMANY' ON TABLE SET STYLE * TYPE=ACROSSVALUE,ACROSS=1,COLUMN=N1,BACKCOLOR='GREEN',$ TYPE=ACROSSVALUE,ACROSS=1,COLUMN=N4,BACKCOLOR='BLUE',$ TYPE=ACROSSVALUE,ACROSS=1,COLUMN=N7,BACKCOLOR='YELLOW',$ TYPE=ACROSSVALUE,ACROSS=1,COLUMN=N10,BACKCOLOR='RED',$ TYPE=ACROSSVALUE,ACROSS=1,COLUMN=N13,BACKCOLOR='ORANGE',$ TYPE=ACROSSVALUE,ACROSS=1,COLUMN=N16,BACKCOLOR='GREY',$ ENDSTYLE END -RUN