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     [SOLVED] STYLE SHEET - When Condition

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] STYLE SHEET - When Condition
 Login/Join
 
Platinum Member
posted
Hi All:

Does the WHEN=FLD test, apply to the field style-sheet lines refers to or you can use the WHEN referring to another filed?

Requirements is to NOT show Brackets or Negative sign for the amounts less than 0, BUT show those in Red Color only

Field A is the original field can be negative or positive .
I defined field B to make it a number (FLDA * -1, if LT 0) , This is used in the subheading to display


For the Stylesheet line for FLD B (which is being displayed)

when I use FLDA in WHEN test it does not work
when I use FLDB in WHEN test it does work (color red)

Thanks

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


Prod/Dev/Test: WF 8.1.5 on (Windows Server 2012 R2 )
SandBox: WebFocus Server 8.1.5 on Windows Server 2008 R2
WebFOCUS App Studio 8.1.5 and Developer Studio 8.1.5 on Windows 7
 
Posts: 134 | Location: USA | Registered: August 21, 2008Report This Post
Virtuoso
posted Hide Post
The WHEN test can refer any field in the "internal matrix", but there are a few gotchas. To my understanding, this is the current situation:

  • It can only handle very basic expressions, such as WHEN=FLD GT 0. Forget about things like WHEN=FLDA GT 3 AND FLDB LT 5, that's over its head.
  • The referenced field has to be in the projection list, visible or not, so it has to be a field in the projection (PRINT, SUM, BY or ACROSS fields). If you just DEFINEd it, I think the field is considered unused in the TABLE-request and doesn't end up in the "internal matrix" and hence isn't available for styling.
  • WHEN expressions can only do comparisons between a field-value and a constant. You can't compare two constants and you can't compare two field values.
  • If you have multiple references to the same field in your projection, say you used it in a COMPUTE and you PRINT it, then the field ends up in the "internal matrix" multiple times and it's possible that you need to "enumerate" your field reference in your STYLE. For example, if you have a FLDA, you may have to reference it as FLDA (2) or even FLDA (3). I suspect you can "list" what's in the internal matrix using ?FF on your TABLE request output if you put it in a HOLD-file. Otherwise you'll need to get it through trial-and-error.


If your requirements surpass these limitations, the usual approach is to DEFINE a field to handle the "complex" expression and turn it into a simple yes-or-no value. Don't forget to PRINT that field though!

Before you ask, yes it matters where your expression is to how the syntax is and what features are supported. Why? Beats me.

If any of the above is incorrect, I'm sure someone will chime in Wink


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 :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Virtuoso
posted Hide Post
A little example including a few WebFOCUS commands:
  
-* File acrosscolor.fex
-* Example repro'd from a customer
-* Customer can choose a number of sortfields
-* The interface inserts BY or ACROSS where needed in the resulting parameter.
-*
-DEFAULT &BY_LIST='COUNTRY BY CAR BY BODYTYPE'
-DEFAULT &ACROSS_LIST='SEATS ACROSS MPG IN-RANGES-OF 15'
-*
-* The user can choose a number of verb objects. Some are COMPUTES defined with the LET command.
-*
LET 
NITZUL=COMPUTE RATIO/D7.2% = RCOST / DCOST * 100;;
NITZULU=COMPUTE RATU/D7.2%=RCU / DCU * 100;;
END
-*
-* Use of DEFINE to create a random couple of fields.
-*
DEFINE FILE CAR
DCU/D7=DCOST * (1+RDUNIF('D3.2'));
RCU/D7=RCOST * (1+RDUNIF('D3.2'));
END
-*
TABLE FILE CAR
SUM 
     DEALER_COST
     RETAIL_COST
     NITZUL
     DCU
     RCU
     NITZULU
BY  &BY_LIST
ACROSS &ACROSS_LIST
ON TABLE SET PAGE-NUM NOLEAD 
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = endeflt,
$
-*
-* Styling using WHEN
-*
TYPE=DATA,
     ACROSSCOLUMN=RATIO,
     BACKCOLOR='RED',
     WHEN=RATIO GT 120,
$
TYPE=DATA,
     ACROSSCOLUMN=RATIO,
     BACKCOLOR='LIME',
     WHEN=RATIO GT 0,
$
TYPE=DATA,
     ACROSSCOLUMN=RATU,
     BACKCOLOR='RED',
     WHEN=RATU GT 120,
$
TYPE=DATA,
     ACROSSCOLUMN=RATU,
     BACKCOLOR='LIME',
     WHEN=RATU GT 0,
$
ENDSTYLE
END


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Platinum Member
posted Hide Post
Hi FOCdeveloper,

As Wep5622 indicates the WHEN test can refer any field in the "internal matrix".
So probably FLDA is not in your internal matrix.
Adding a "FLDA NOPRINT" might do the trick for you.

Martin.


WebFocus 8206M, iWay DataMigrator, Windows, DB2 Windows V10.5, MS SQL Server, Azure SQL, Hyperstage, ReportCaster
 
Posts: 168 | Registered: March 29, 2013Report This Post
Platinum Member
posted Hide Post
Thanks All.. Right after I posted this.. I used COMPUTE for the testing field in WHEN and it worked..

Yes It has to be in the internal matrix, that was the issue when I just had it in a define and not in PRINT ..

Thanks


Prod/Dev/Test: WF 8.1.5 on (Windows Server 2012 R2 )
SandBox: WebFocus Server 8.1.5 on Windows Server 2008 R2
WebFOCUS App Studio 8.1.5 and Developer Studio 8.1.5 on Windows 7
 
Posts: 134 | Location: USA | Registered: August 21, 2008Report This Post
Virtuoso
posted Hide Post
No, a DEFINE does not add a field to the internal matrix unless you use it.


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 :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report 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     [SOLVED] STYLE SHEET - When Condition

Copyright © 1996-2020 Information Builders