Focal Point
[CLOSED] Computed flags not recognized for stylesheet.

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

July 02, 2009, 02:26 PM
Tomsweb
[CLOSED] Computed flags not recognized for stylesheet.
I have created this flag to control how various rows are displayed in a PDF or EXL2K report:
quote:

COMPUTE PAMFLAG/A1 = IF (PCTALLMEET FROM 91 TO 100) THEN '1'
ELSE IF (PCTALLMEET EQ 90) THEN '2'
ELSE IF (PCTALLMEET FROM 75 TO 89) THEN '3'
ELSE IF (PCTALLMEET FROM 0 TO 74) THEN '4' ELSE '0';

Here is the stylesheet code:
quote:

$
TYPE=DATA,
COLOR='WHITE',
STYLE=BOLD,
BACKCOLOR='BLUE',
WHEN=PAMFLAG EQ '1',
$
TYPE=DATA,
COLOR='WHITE',
STYLE=BOLD,
BACKCOLOR='GREEN',
WHEN=PAMFLAG EQ '2',
$
TYPE=DATA,
COLOR='BLACK',
STYLE=NORMAL,
BACKCOLOR='YELLOW',
WHEN=PAMFLAG EQ '3',
$
TYPE=DATA,
COLOR='BLACK',
STYLE=NORMAL,
BACKCOLOR='RED',
WHEN=PAMFLAG EQ '4',
$

Whenever I have a PCTALLMEET value of 74 or 91 show in the report, the backcolor is WHITE,
rather than a backcolor=RED for 74 and backcolor=BLUE for 91.

I have also coded it as:
quote:

COMPUTE PAMFLAG/A1 = IF (PCTALLMEET GE 91) AND (PCTALLMEET LE 100) THEN '1'
ELSE IF (PCTALLMEET EQ 90) THEN '2'
ELSE IF (PCTALLMEET GE 75) AND (PCTALLMEET LE 89) THEN '3'
ELSE IF (PCTALLMEET GE 0) AND (PCTALLMEET LE 74) THEN '4' ELSE '0';

but it does not matter. Is there another way to compute a flag for a range of values? Confused

Thanks!

This message has been edited. Last edited by: Kerry,


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
July 02, 2009, 03:12 PM
RSquared
HAVE YOU TRIED IT THIS WAY?

 
COMPUTE PAMFLAG/A1 = IF (PCTALLMEET GT 90) AND (PCTALLMEET LT 101) THEN '1'
ELSE IF (PCTALLMEET EQ 90) THEN '2'
ELSE IF (PCTALLMEET GT 74) AND (PCTALLMEET LT 90) THEN '3'
ELSE IF (PCTALLMEET GE 0) AND (PCTALLMEET LT 75) THEN '4' ELSE '0';

 



WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
July 02, 2009, 03:14 PM
Mighty Max
In your computed field make your range order from lowest to highest.

  
TABLE FILE CAR
PRINT
     CAR
	 SALES
	 COMPUTE PAMFLAG/A1 = IF (SALES FROM 0 TO 4800)THEN '1'
                          ELSE IF (SALES FROM 4801 TO 13000) THEN '2'
                          ELSE IF (SALES FROM 13001 TO 14000) THEN '3'
                          ELSE IF (SALES FROM 14001 TO 15600) THEN '4' ELSE '0';
BY
     COUNTRY
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE SET ONLINE-FMT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     UNITS=IN,
     PAGESIZE='SCREEN',
     LEFTMARGIN=0.000000,
     RIGHTMARGIN=0.000000,
     TOPMARGIN=0.000000,
     BOTTOMMARGIN=0.000000,
     SQUEEZE=ON,
     ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
     GRID=OFF,
     FONT='ARIAL',
     SIZE=9,
     COLOR='BLACK',
     BACKCOLOR='NONE',
     STYLE=NORMAL,
     RIGHTGAP=0.125000,
     TOPGAP=0.013889,
     BOTTOMGAP=0.027778,
$
TYPE=TITLE,
     STYLE=BOLD,
$
TYPE=DATA,
COLOR='WHITE',
STYLE=BOLD,
BACKCOLOR='BLUE',
WHEN=PAMFLAG EQ '1',
$
TYPE=DATA,
COLOR='WHITE',
STYLE=BOLD,
BACKCOLOR='GREEN',
WHEN=PAMFLAG EQ '2',
$
TYPE=DATA,
COLOR='BLACK',
STYLE=NORMAL,
BACKCOLOR='YELLOW',
WHEN=PAMFLAG EQ '3',
$
TYPE=DATA,
COLOR='BLACK',
STYLE=NORMAL,
BACKCOLOR='RED',
WHEN=PAMFLAG EQ '4',
$
ENDSTYLE
END
-EXIT



WebFOCUS 8.1.05M Unix Self-Service/MRE/Report Caster - Outputs Excel, PDF, HTML, Flat Files
July 02, 2009, 03:45 PM
Darin Lee
There are 101 different ways to code the compute, but before figuring out why the stylesheet is not working, look at what the values of the computed field PAMFLAG and reference field PCTALLMEET are. If you are doing a COMPUTE instead of a DEFINE I would guess maybe you are doing a SUM in which case the '74' values may be some multiple of 74.

Here's the way I would code your flag:

COMPUTE PAMFLAG/A1 =
IF PCTALLMEET LT 75 THEN '4' ELSE
IF PCTALLMEET LT 90 THEN '3' ELSE
IF PCTALLMEET EQ 90 THEN '2' ELSE
IF PCTALLMEET LE 100 THEN '1' ELSE '0';

Forget about the ranges, just let it flow through natural logic.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
July 02, 2009, 04:06 PM
GamP
Indeed, first run the report with all fields visible without bothering to look at the styling, but to look if all field values are correct.
Only when that is correct, take a closer look at your stylesheet.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
July 02, 2009, 04:57 PM
T.Peters
How does the "FROM-TO" logic work? Without being an expert, it seems like FROM is analagous to > and TO is <. So if you have exactly 91, it doesn't fit the criteria.

Maybe try something like Rsquared suggested or make your statement FROM 90 TO 100.


WebFOCUS: 7702
O/S : Windows
Data Migrator: 7702
July 02, 2009, 06:18 PM
Darin Lee
FROM-TO logic is inclusive, meaning greater- than-or-equal-to and less-than-or-equal-to


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
July 03, 2009, 02:24 AM
Tony A
I would recommend using the approach Darin suggests and use the logically route. Of course the values used do really depend upon the format of the field being tested.


Tom,

What are the USAGE and ACTUAL formats of the field PCTALLMEET?

If decimal fomrat then even more reason to use Darin's suggestion, although I would modify it to -
COMPUTE PAMFLAG/A1 = 
IF PCTALLMEET LT  0 THEN '0' ELSE
IF PCTALLMEET LT 75 THEN '4' ELSE
IF PCTALLMEET LT 90 THEN '3' ELSE
IF PCTALLMEET LT 91 THEN '2' ELSE
IF PCTALLMEET LT 101 THEN '1' ELSE '0';

This way you get ranges of 0 - 74.9999~, 75 - 89.9999~, 90 - 90.9999~ and 91 - 100.9999~ which is what you are after?

T

This message has been edited. Last edited by: Tony A,



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10