Focal Point
Mulitiple Formats for one Field

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

May 24, 2006, 02:19 PM
Nailzz
Mulitiple Formats for one Field
At the carfuse in Chapel Hill there was technique shown where you can use multiple formats for a field. For instance I know that in my print statement I can use PCT1/D15.1S or PCT2/D15S% by Indicator (field), which results in 98.2 or 98%. I want to use the multiple formatting technique so that PCT1 can be 98% or 98.2 depending upon the indicator (field). Can someone send the code or point me in the right direction?


WebFOCUS 7.1.3 on Win 2000
May 24, 2006, 04:38 PM
Nailzz
I guess no one went to the CARFUSE meeting in Chapel Hill.

Does anyone have and idea how to do this?


WebFOCUS 7.1.3 on Win 2000
May 24, 2006, 07:43 PM
jimster06
-SET &VAR1 = 'D15.5S';
-SET &VAR2 = 'D15S%';
-SET &FMT = IF INDICATOR EQ 'Y' THEN '&VAR1' ELSE '&VAR2';
DEFINE MY_FILE
FIELDX/'&FMT' = FIELDZ;
END
TABLE FILE MY_FILE
PRINT FIELDX
END

or

without the define
TABLE FILE MY_FILE
PRINT FIELDZ/'&FMT'
END


Understand that I am doing this from memory and that there may be a number of other ways to do this.
And forgive me if quote marks are wrong.

This message has been edited. Last edited by: jimster06,
May 24, 2006, 08:28 PM
dhagen
An example:
  
DEFINE FILE CAR
FMT/A8=DECODE COUNTRY ( 'ENGLAND' 'P10!L' 'JAPAN' 'P10!Y' ELSE 'P10!E');
END
TABLE FILE CAR
SUM
     DEALER_COST/FMT
     RETAIL_COST/FMT
     SALES/FMT
BY COUNTRY
ON TABLE NOTOTAL
ON TABLE SET HTMLCSS ON
END


Result
 
COUNTRY DEALER_COST RETAIL_COST    SALES 
ENGLAND     £37,853     £45,319  £12,000 
FRANCE       €4,631      €5,610       €0 
ITALY       €41,235     €51,065  €30,200 
JAPAN        ¥5,512      ¥6,478  ¥78,030 
W GERMANY   €54,563     €64,732  €88,190 



"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
May 25, 2006, 11:08 AM
Nailzz
Thanks all, I will try it and let you all know the results.


WebFOCUS 7.1.3 on Win 2000
June 01, 2006, 03:49 PM
Nailzz
Thank you, thank you dhagen this is exactly what I needed and worked perfectly for my report. If anyone needs to show data in several formats line by line then this work for me. Some of my data needed to present as a percentage other as just a rate. Thanks again.


WebFOCUS 7.1.3 on Win 2000