Focal Point
Negative Bracket not working

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

March 31, 2008, 12:57 PM
ajayantony
Negative Bracket not working
Hi,
Please look at the piece of code,
TABLE FILE ABC
AAA / D10B = BBB - CCC;
END

The output of the above code has brackets replacing negative values, i.e. -10.12 , is displayed as (10).
But when say the result of the difference is -0.12, the output is just 0, with no brackets around it.

What should i do to overcome this problem?
Expected output is (0)


WebFOCUS 7.6.6
Windows XP
Output: Excel, PDF, HTML
March 31, 2008, 01:23 PM
Leah
As you are not allowing for decimal places in your format,D10B, the -0.12 is marked as zero which I'm assuming FOCUS and WebFOCUS treat as a positive number.


Leah
March 31, 2008, 11:09 PM
ajayantony
Thanks.
But the problem is, is have this bit of code in the style sheet as well,

TABLE FILE ABC
AAA / D10B = BBB - CCC;
END
COLUMN=AAA,COLOR=RED,WHEN=AAA LT 0, $

So what happens is when AAA is 0 i.e. say -0.12 being rounded of to 0, brackets do not appear around it but it is highlighted in red color.

I want either the brackets to appear or the value should not be colored when its rounded off to 0


WebFOCUS 7.6.6
Windows XP
Output: Excel, PDF, HTML
April 01, 2008, 02:30 AM
Tony A
Either extend the decimal places shown on the field so that your expression is correct or do not use double precision as its format, as double precision retains the true value internally.

You can see what I mean in the code below. Firstly I compute a value based on two numeric fields. The computed output has no decimal places but the result is then passed to a computed field that does have decimal places. I do this twice, once for double precision and once for packed decimal. Comparison of the passed computed value shows that double precision still holds the "true" value whereas packed decimal doesn't.

APP PREPENDPATH IBISAMP
TABLE FILE GGSALES
SUM DOLLARS
    BUDDOLLARS
    COMPUTE D_DIFF/D10B = 1 - (DOLLARS / BUDDOLLARS);
    COMPUTE D_PASS/D10.5B = D_DIFF;
    COMPUTE P_DIFF/P10B = 1 - (DOLLARS / BUDDOLLARS);
    COMPUTE P_PASS/P10.5B = P_DIFF;
BY REGION
ON TABLE SET HTMLCSS ON
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
  GRID=OFF, SIZE=9, $
  TYPE=DATA, COLUMN=D_PASS, COLOR=RED, WHEN=D_PASS LT 0, $
  TYPE=DATA, COLUMN=P_PASS, COLOR=RED, WHEN=P_PASS LT 0, $
ENDSTYLE
END

Rule: Use the correct precision for the task in hand Smiler

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