Focal Point
Conditional Styling - some .0 are red, some aren't, HELP!

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

June 23, 2004, 07:12 PM
<matty@time>
Conditional Styling - some .0 are red, some aren't, HELP!
I'm using this format on a computed field,

COMPUTE SCHG/D6.1B=(PCT.&SHOW1-PCT.&SHOW2);

The "B" gives you (21.1) in place of -21.1, so then I add this line to the stylesheet:

TYPE=DATA, COLUMN=SCHG, COLOR=RED, WHEN=SCHG LT 0, $

Works great, until WebFOCUS decides to carry out the calculation past the D6.1, so I end up with some RED .0 that dont have brackets. Seems the "B" cuts off based on the D6.1, but the stylesheet code doesn't. Can I force the stylesheet to only use the displayed values? I.E. the D6.1?

HELP!

Matthew
CMI@Time Inc
matthew_rossi@timeinc.com
June 23, 2004, 07:17 PM
<Pietro De Santis>
Have you tried increasing the size of the field:

D8.1B

?
June 23, 2004, 07:27 PM
<matty@time>
I'll try it, but how would that help if the problem seems to come from the way "B" and stylesheet comands read values AFTER the decimal?

For example:

If the real value is

-.0001 but I'm using D6.1B I wont get (.0) I just get .0 which is fine.

But, conditional styling will turn this RED (ignoring the D6.1) anyway, which stinks.

M
June 23, 2004, 07:39 PM
<Pietro De Santis>
I'm not sure what you mean by "until WebFOCUS decides to carry out the calculation past the D6.1"?



TABLE FILE CAR
PRINT MODEL
COMPUTE APPLE/D6.1B = -10.5;
COMPUTE ORANGE/D6.1B = -2000.5;
COMPUTE BANANA/D6.1B = -200550.5;

WHERE RECORDLIMIT EQ 5

HEADING
" "

ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLESHEET *
TYPE=REPORT, GRID=OFF,
FONT='VERDANA', SIZE=8, $
TYPE=DATA, COLUMN=APPLE, COLOR=RED, WHEN=APPLE LT 0, $
TYPE=DATA, COLUMN=ORANGE, COLOR=RED, WHEN=ORANGE LT 0, $
TYPE=DATA, COLUMN=BANANA, COLOR=RED, WHEN=BANANA LT 0, $
ENDSTYLE
END

gives me red data even if the data is too large to display in the D6.1B.

This message has been edited. Last edited by: <Mabel>,
June 23, 2004, 07:54 PM
<matty@time>
This is what i mean, AFTER the DECIMAL, run this, you will understand, you'll get RED .0 without the ().



TABLE FILE CAR
PRINT MODEL
COMPUTE APPLE/D6.1B = -10.5;
COMPUTE ORANGE/D6.1B = -2000.5;
COMPUTE BANANA/D6.1B = -200550.5;
COMPUTE CRAP/D6.1B = -0.0001;
WHERE RECORDLIMIT EQ 5
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLESHEET *
TYPE=REPORT, GRID=OFF, FONT='VERDANA', SIZE=8, $
TYPE=DATA, COLUMN=APPLE, COLOR=RED, WHEN=APPLE LT 0, $
TYPE=DATA, COLUMN=ORANGE, COLOR=RED, WHEN=ORANGE LT 0, $
TYPE=DATA, COLUMN=BANANA, COLOR=RED, WHEN=BANANA LT 0, $
TYPE=DATA, COLUMN=CRAP, COLOR=RED, WHEN=CRAP LT 0, $
ENDSTYLE
END

This message has been edited. Last edited by: <Mabel>,
June 23, 2004, 08:20 PM
<Pietro De Santis>
Works for me:



Must have been fixed in a recent version.
June 23, 2004, 08:48 PM
Mikel
Try using P format:

COMPUTE SCHG/P6.1BC = ... ;

Example with CAR file:

TABLE FILE CAR
PRINT
COUNTRY NOPRINT
COMPUTE DECIMAL/D6.1B = -0.0001 ;
COMPUTE PACKED/P6.1B = -0.0001 ;
IF RECORDLIMIT EQ 1
ON TABLE SET STYLESHEET *
TYPE=REPORT, GRID=OFF, $
TYPE=DATA, COLUMN=DECIMAL, COLOR=RED, WHEN=DECIMAL LT 0, $
TYPE=DATA, COLUMN=PACKED , COLOR=RED, WHEN=PACKED LT 0, $
ENDSTYLE
END

Results

Column DECIMAL .0 red
Column PACKED .0 black

Explanation from Creating Reports - Numeric Formats - Rounding
quote:

  • Packed‑decimal format. When a value is assigned to a packed‑decimal field, and the value has more decimal places than the field's format specifies, the value is rounded before it is stored.
  • Floating‑point double and single‑precision formats. When a value is assigned to one of these fields, and the value has more decimal places than the field's format specifies, the full value is stored in the field (up to the limit of precision determined by the field's internal storage type). When this value is later displayed, however, it is rounded.

Regards,
Mikel

This message has been edited. Last edited by: <Mabel>,
June 23, 2004, 08:52 PM
<wwmyers>
Change D6.1B to P6.1B

It will be rounded to 1 decimal place and should work