As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
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,
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
Posts: 132 | Location: Gadsden, Al | Registered: July 22, 2005
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