Focal Point
[SOLVED] STYLE SHEET - When Condition

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/7317098476

February 26, 2015, 01:26 PM
FOCdeveloper
[SOLVED] STYLE SHEET - When Condition
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
February 27, 2015, 03:55 AM
Wep5622
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:

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 :
February 27, 2015, 09:19 AM
Danny-SRL
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

March 02, 2015, 02:52 AM
Martin vK
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
March 02, 2015, 01:22 PM
FOCdeveloper
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
March 03, 2015, 08:07 AM
Wep5622
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 :