Focal Point
conditionally formatting a field webfocus 5.2

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

November 07, 2003, 02:16 PM
Vivian
conditionally formatting a field webfocus 5.2
In WebFOCUS 5.2 does anyone have a way to conditionally format a field by changing the actual format. What I want is this:

table file car
print price and compute
perc/d5.1% = if country eq 'france' then .... else
whole/d5 = if country ne 'france' then ....

anyway, you get the idea - I either want a whole number to display or a fraction that is a percentage to display. I know the above is not correct syntax just trying to give the idea that in the same column either a whole or fraction.

Do I have to use FRL to achieve this?

Thanks in advance,
Vivian Perlmutter
www.aviter.com
vivian@aviter.com
November 07, 2003, 06:04 PM
<mhuber>
Try this:


TABLE FILE CAR
PRINT
DEALER_COST
RETAIL_COST
COMPUTE WHOLE = RETAIL_COST - DEALER_COST; NOPRINT
COMPUTE PCT = 100 * DEALER_COST / RETAIL_COST; NOPRINT
COMPUTE MYVAL/A10 = IF COUNTRY EQ 'ITALY'
THEN FTOA(PCT, '(D5.2%)', MYVAL)
ELSE FTOA(WHOLE, '(D7)', MYVAL);
BY CAR
BY MODEL
BY COUNTRY
END

The major caveat is that MYVAL is an alpha field... meaning you can't aggregate it. Although I'm not sure you'd want to aggregate whole numbers with percents anyway!

I hope this helps.
-Michael

This message has been edited. Last edited by: <Mabel>,
November 10, 2003, 12:47 PM
Vivian
Thank you, thank you,

With a little tweaking to match my code, it worked perfectly!

Vivian Perlmutter