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.
The column-value based color styling does not work in the following example - I do not get colours. v7.7.03 HF4. I don't think my syntax is wrong - am I missing something?
TABLE FILE CAR
SUM
COMPUTE FLG1/A1 = IF SALES LT 8000 THEN '1' ELSE IF SALES GT 8000 THEN '2';
SALES
BY COUNTRY
BY CAR
BY MODEL
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=SALES, COLOR=RED, WHEN= FLG1 EQ '1', $
TYPE=DATA, COLUMN=SALES, COLOR=GREEN, WHEN= FLG1 EQ '2', $
END
This message has been edited. Last edited by: Francis Mariani,
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
Maybe be a bug - seems to work if I remove the COMPUTE or move the COMPUTE below SALES after the SUM verb.
TABLE FILE CAR
SUM
SALES
COMPUTE FLG1/A1 = IF SALES LT 8000 THEN '1' ELSE IF SALES GT 8000 THEN '2';
BY COUNTRY
BY CAR
BY MODEL
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=SALES, COLOR=RED, WHEN=SALES GT 8000, $
TYPE=DATA, COLUMN=SALES, COLOR=BLUE, WHEN=SALES LT 8000, $
ENDSTYLE
END
WebFOCUS 7.7.05
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007
Francis, IF-THEN-ELSE logic, AND, put the COMPUTE after:
TABLE FILE CAR
SUM
SALES
COMPUTE FLG1/A1 = IF SALES LE 8000 THEN '1' ELSE '2';
BY COUNTRY
BY CAR
BY MODEL
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=SALES, COLOR=RED, WHEN= FLG1 EQ '1', $
TYPE=DATA, COLUMN=SALES, COLOR=GREEN, WHEN= FLG1 EQ '2', $
END
-EXIT
TABLE FILE CAR
SUM
COMPUTE COL1/D1 = IF HEIGHT LT 8000 THEN 1 ELSE IF SALES GT HEIGHT THEN 2 ELSE 0;
COMPUTE COL2/D6 = LENGTH * HEIGHT * WIDTH;
SALES
BY COUNTRY
BY CAR
BY MODEL
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=SALES, COLOR=GREEN, WHEN= SALES GT 8000, $
TYPE=DATA, COLUMN=SALES, COLOR=RED, WHEN= SALES LT 8000, $
END
This does work:
TABLE FILE CAR
SUM
COMPUTE COL2/D6 = LENGTH * HEIGHT * WIDTH;
SALES
BY COUNTRY
BY CAR
BY MODEL
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=SALES, COLOR=GREEN, WHEN= SALES GT 8000, $
TYPE=DATA, COLUMN=SALES, COLOR=RED, WHEN= SALES LT 8000, $
END
SO does this:
TABLE FILE CAR
SUM
SALES
COMPUTE FLG1/A1 = IF SALES LT 8000 THEN '1' ELSE IF SALES GT 8000 THEN '2' ELSE '0';
BY COUNTRY
BY CAR
BY MODEL
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=SALES, COLOR=RED, WHEN= FLG1 EQ '1', $
TYPE=DATA, COLUMN=SALES, COLOR=GREEN, WHEN= FLG1 EQ '2', $
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
Mention of SALES in the COMPUTE is the problem. WF must be creating a new SALES column for the compute. This works by identifying the second SALES column for styling:
TABLE FILE CAR
SUM
COMPUTE COL1/D1 = IF HEIGHT LT 8000 THEN 1 ELSE IF SALES GT HEIGHT THEN 2 ELSE 0;
COMPUTE COL2/D6 = LENGTH * HEIGHT * WIDTH;
SALES
BY COUNTRY
BY CAR
BY MODEL
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=SALES(2), COLOR=GREEN, WHEN= SALES GT 8000, $
TYPE=DATA, COLUMN=SALES(2), COLOR=RED, WHEN= SALES LT 8000, $
END
WebFOCUS 7.7.05
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007
The other option is to use relative column numbers like Pn, Bn Cn, etc
TABLE FILE CAR
SUM
COMPUTE FLG1/A1 = IF SALES LT 8000 THEN '1' ELSE IF SALES GT 8000 THEN '2';
SALES
BY COUNTRY
BY CAR
BY MODEL
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=P5, COLOR=RED, WHEN= FLG1 EQ '1', $
TYPE=DATA, COLUMN=P5, COLOR=GREEN, WHEN= FLG1 EQ '2', $
END
Aha, so invisible fields in the internal matrix have impact on style definitions?!? That explains some curious problems I've had with styling, I wish I'd have known that before.
It makes me wonder though, why is that? That's like handing someone a shotgun with the barrel pointing straight down and not telling them it's loaded and the safety is off. Your report is going to look like your foot: messed up.
We've often switched to using numbered columns (like Waz suggests) after encountering issues like these, but numbered columns have the severe drawback that adding new columns or computations before existing ones (because you need the result in a next computation) breaks your styling - the column numbering changes. It's even more of a pain with ACROSS-columns, which don't seem like they can be referenced by name at all.
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010 : Member of User Group Benelux :