I have been playing around in 7.69 with a simple test style sheet report (to port this code to a business applicaation).
And, I am not getting the result I want. I am hoping to get the Country column to display in RED ITALIC when a new country is displayed.
Any ideas?
Thanks!
quote:
-SET &ECHO=ALL;
SET NODATA = ' ', HOLDLIST = PRINTONLY
TABLE FILE CAR PRINT COMPUTE CFLAG/A1 = IF COUNTRY EQ LAST COUNTRY THEN '0' ELSE IF COUNTRY NE LAST COUNTRY THEN '1' ELSE '0'; CAR MODEL BODYTYPE BY COUNTRY ON TABLE HOLD AS FL1 END -RUN
TABLE FILE FL1 PRINT CAR MODEL BODYTYPE BY COUNTRY ON TABLE PCHOLD FORMAT EXL2K ON TABLE SET HTMLCSS ON ON TABLE SET STYLE * UNITS=IN, SQUEEZE=ON, ORIENTATION=PORTRAIT, $ TYPE=REPORT, GRID=OFF, FONT='ARIAL', SIZE=9, RIGHTGAP=0.125000, $ TYPE=HEADING, FONT='TIMES NEW ROMAN', SIZE=12, BACKCOLOR=RGB(255 255 153), $ TYPE=HEADING, LINE=1, OBJECT=TEXT, ITEM=1, COLOR='GREEN', STYLE=BOLD, JUSTIFY=CENTER, $ TYPE=DATA, STYLE=ITALIC, COLOR='RED', BACKCOLOR='WHITE', WHEN=CFLAG EQ '1', $ TYPE=DATA, STYLE=NORMAL, COLOR='BLUE', BACKCOLOR='WHITE', WHEN=CFLAG EQ '0', $ ENDSTYLE -NOSTY END -RUN
This message has been edited. Last edited by: Tomsweb,
You must specify the column in a MACRO in the Table Request.
Add CFLAG NOPRINT, and it should work.
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
January 21, 2010, 05:23 PM
Dan Satchell
You may also need to add COLUMN=COUNTRY to your two DATA stylesheet statements if you only want the COUNTRY column styled.
WebFOCUS 7.7.05
January 21, 2010, 05:30 PM
rfbowley
I see fourissues.
1) you do not have CFLAG in your second matrix, hence the conditions can never be met. Add: BY CFLAG NOPRINT
to your output after the BY COUNTRY line.
2) You did not turn BYDISPAY ON, hence the only time you will ever see the COUNTRY value is when it changes. Since your backcolor is always white, I would just set the style to red italic for the country column and forget the conditions
3) Which brings me to issue 3, which is you did not include a COLUMN=N1, or COLUMN=COUNTRY, line in either TYPE=DATA, section of the style sheet, so the style would have affected all colimns had CFLAG been in the data set.
4) The first record displayed in a report has no "LAST" to compare to. The default here is that it is the first record IS the same as that non existant "LAST", hence using oyur techniques here, the first country will always be blue.
Hope this helps.
Robert F. Bowley Jr. Owner TaRa Solutions, LLC
In WebFOCUS since 2001
January 21, 2010, 06:51 PM
Francis Mariani
You probably want the whole line with a new country in italic red, if so, you need to make one small change - add "CFLAG NOPRINT":
-SET &ECHO=ALL;
SET NODATA = ' ', HOLDLIST = PRINTONLY
TABLE FILE CAR
PRINT
COMPUTE CFLAG/A1 = IF COUNTRY EQ LAST COUNTRY THEN '0'
ELSE IF COUNTRY NE LAST COUNTRY THEN '1' ELSE '0';
CAR
MODEL
BODYTYPE
BY COUNTRY
ON TABLE HOLD AS FL1
END
-RUN
TABLE FILE FL1
PRINT
CFLAG NOPRINT
CAR
MODEL
BODYTYPE
BY COUNTRY
ON TABLE PCHOLD FORMAT EXL2K
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
UNITS=IN,
SQUEEZE=ON,
ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
GRID=OFF,
FONT='ARIAL',
SIZE=9,
RIGHTGAP=0.125000,
$
TYPE=HEADING,
FONT='TIMES NEW ROMAN',
SIZE=12,
BACKCOLOR=RGB(255 255 153),
$
TYPE=HEADING,
LINE=1,
OBJECT=TEXT,
ITEM=1,
COLOR='GREEN',
STYLE=BOLD,
JUSTIFY=CENTER,
$
TYPE=DATA,
STYLE=ITALIC,
COLOR='RED',
BACKCOLOR='WHITE',
WHEN=CFLAG EQ '1',
$
TYPE=DATA,
STYLE=NORMAL,
COLOR='BLUE',
BACKCOLOR='WHITE',
WHEN=CFLAG EQ '0',
$
ENDSTYLE
-NOSTY
END
-RUN
The WHEN clause in the stylesheet requires that the referenced field be in the report NOPRINT or not.
In my many years of WebFOCUS coding I have never NEEDed to code a MACRO in a stylesheet - some people may prefer to but I don't.
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