Focal Point Banner


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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Change the font to green when there is negative value

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Change the font to green when there is negative value
 Login/Join
 
Guru
posted
Hi,

I have a query and say if I run it,say I may get columns 1,2 and 3 and out of which column 3 gives the number of units sold in $.
Now say I will get 3 rows for Column 3 with the values such as $3.00(row 1), $-4.99(row2 ) and $-5.00 (row 3).I need to change the font to green only if there is negative currency(say in the above case,it is row 2 and row3) and to black font if it is a positive currency(row 1).

Can anyone please let me know how to do this in a styling part/section using sample car file.

Any help is greatly appreciated.

Thanks a lot in advance!

Regards,
IP

This message has been edited. Last edited by: <Kathryn Henning>,


Webfocus 8105 Developer studio,Windows 7,HTML,Excel,PDF,Text,Infoassist,Graph,AHTML
 
Posts: 270 | Registered: October 30, 2014Report This Post
Virtuoso
posted Hide Post
GUI does it for you.

Right click on field you want to apply color, Options, Style, Edit Conditions, New, Apply color to font.

TABLE FILE CAR
PRINT
     COMPUTE N_RET/D10 = RETAIL_COST - 10000;
BY  CAR.ORIGIN.COUNTRY
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE SET STYLE *
$
     DEFMACRO=COND0001,
     MACTYPE=RULE,
     WHEN=N2 LT 0,
$
TYPE=DATA,
     COLUMN=N2,
     COLOR='GREEN',
     MACRO=COND0001,
$
ENDSTYLE
END


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Expert
posted Hide Post
It is also in the documentation.

Take a look at MACRO's and the WHEN statement.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Platinum Member
posted Hide Post
I mostly skip the MACRO part for clarity and prefer to use the column names. This way when columns are being added or removed, the conditional styling keeps working and there is no need for renumbering:

 TABLE FILE CAR
PRINT
     COMPUTE N_RET/D10 = RETAIL_COST - 10000;
BY  CAR.ORIGIN.COUNTRY
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE SET STYLE *
$
TYPE=DATA,
     COLUMN=N_RET,
     COLOR='GREEN',
     WHEN=N_RET LT 0,
$
ENDSTYLE
END
 


WebFOCUS 8105m
Windows 7, All Outputs

Member of the Benelux Usergroup
 
Posts: 198 | Location: Amsterdam | Registered: August 24, 2011Report This Post
Virtuoso
posted Hide Post
You are right SWES, using the MACRO with the column name is normally what I am doing, but I did the code with the GUI just to be sure that everything remain as the GUI does and show that it's possible.

The advantage of the MACRO is that it can be reused for many columns' styling without having to define the condition on every columns.

It also make the code more clear when using the field name instead of the reference. Using the reference may sometime be confusing especially with COMPUTEs and MULTI LEVEL. Many treads speak about a column with style change when it's not supposed to be that one because a internal MATRIX field (not displayed) as to be considered in the column reference count.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Platinum Member
posted Hide Post
Martin, true that!


WebFOCUS 8105m
Windows 7, All Outputs

Member of the Benelux Usergroup
 
Posts: 198 | Location: Amsterdam | Registered: August 24, 2011Report This Post
Guru
posted Hide Post
Hi,

Thanks a lot for the quick response.
But I have to enclose that value within braces say {$3.00}....

Any help is greatly appreciated.

Thanks a lot in advance!

Regards,
IP


Webfocus 8105 Developer studio,Windows 7,HTML,Excel,PDF,Text,Infoassist,Graph,AHTML
 
Posts: 270 | Registered: October 30, 2014Report This Post
Expert
posted Hide Post
This is very simple; I "always" set a FLAG and never use DEFMACRO, my 2 cents:
  
TABLE FILE CAR
PRINT
     COMPUTE N_RET/P10.2BC = RETAIL_COST - 10000;
     COMPUTE FLAG/A1 = IF N_RET LT 0 THEN 'Y' ELSE 'N'; NOPRINT
BY  CAR.ORIGIN.COUNTRY
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE SET STYLE *
$
TYPE=DATA,
     COLUMN=N_RET,
     COLOR='GREEN',
     WHEN=FLAG EQ 'Y',
$
ENDSTYLE
END
-EXIT


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Guru
posted Hide Post
Hi,

I need this bracket -> ($3.00)...Sorry for the confusion.

Thanks,
IP


Webfocus 8105 Developer studio,Windows 7,HTML,Excel,PDF,Text,Infoassist,Graph,AHTML
 
Posts: 270 | Registered: October 30, 2014Report This Post
Expert
posted Hide Post
P10.2BCM


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Change the font to green when there is negative value

Copyright © 1996-2020 Information Builders