|
||||||||||||
Focal Point Forums
WebFOCUS/FOCUS Forum on Focal Point
[SOLVED] Different Formats in 1 field??Go ![]() | New ![]() | Search ![]() | Notify ![]() | Tools ![]() | Reply ![]() | |
| Silver Member |
I was wondering if it's possible to display different formats in a single field for a report. I have 1 field in my data that displays all the values we may need for any measure. The format of the field is A50V, I need to display these values in this field as either percent, number or string depending on which measure the value is for. Is this possible?? Here is an example of what the data looks like Measure Name Score Measure 1 50 Measure 2 Very High Measure 3 88 Then here is what I need to the report to look like Measure Name Score Measure 1 50 minutes Measure 2 Very High Measure 3 88% Any and all advice is appreciated, thanks!!This message has been edited. Last edited by: cldiaz, WebFOCUS 8204 Windows, All Outputs | ||
|
| Platinum Member |
Yes It is possible, Make conditional compute(varchar) in your table file request , Try Something like this, or paste your sample code TABLE FILE CAR
SUM
COMPUTE SCORE/A28V = IF CAR EQ 'AUDI' THEN (PTOA(SEATS, '(P3)', 'A5V')|'%') ELSE IF CAR EQ 'BMW' THEN (PTOA(SEATS, '(P3)', 'A4V')|'Minutes') ELSE 'Very High'; AS 'Score'
BY CAR.COMP.CAR
WHERE CAR IN ('AUDI' , 'BMW' , 'ALFA ROMEO');
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,
$
ENDSTYLE
END
--------------------- CAR |Score -----------|------- ALFA ROMEO |Very High AUDI |5 % BMW |29 MinutesThis message has been edited. Last edited by: Chaudhary, WF Production :- WF:8.0.0.4, 8.1.05 App-studio/Developer Studio(8.1.x) , 8.2.0.1M , 8.2.0.2 (App-Studio8.2.x), InfoAssist/+, InfoDiscovery Output format:-AHTML, PDF, Excel, HTML Platform:-Windows 7, 8,10 | |||
|
| Virtuoso |
You can DEFINE a format specifier field containing the desired WF display format and use that as your measure's type. This format field has to be absolutely positively specified as nothing else than type A8, or it won't work. DEFINE FILE CAR
FMT/A8 = DECODE CAR ('AUDI' 'P3%', 'BMW' 'D12.3' ELSE 'D12');
END
TABLE FILE CAR
PRINT SEATS/FMT
BY CAR
BY MODEL
ENDWebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010 : Member of User Group Benelux : | |||
|
| Virtuoso |
Or you may also want to take a look at FPRINT function
DEFINE FILE CAR
DCOST /P5 = DEALER_COST;
RCOST /P6CM = RETAIL_COST;
PCT /P6.1% = (RETAIL_COST - DEALER_COST) / RETAIL_COST * 100;
END
TABLE FILE CAR
SUM DEALER_COST
RETAIL_COST
DCOST
RCOST
PCT
COMPUTE MIXFIELD /A10V = IF COUNTRY EQ 'ENGLAND' THEN FPRINT(DCOST, 'P5', 'A10V') ELSE IF COUNTRY EQ 'ITALY' THEN FPRINT(RCOST, 'P6CM', 'A10V') ELSE FPRINT(PCT, 'P6.1%', 'A10V');
BY COUNTRY
BY CAR
WHERE COUNTRY EQ 'ENGLAND' OR 'ITALY' OR 'JAPAN';
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,
$
ENDSTYLE
END
WF versions : Prod 8.2.0.1M gen 240, Dev 8.2.04 gen 48, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007 | |||
|
| Silver Member |
Thanks all, I really appreciate the responses! I ended up using Chaudharys solution and was able to get the data to display as different formats. WebFOCUS 8204 Windows, All Outputs | |||
|
| Expert |
i use the same thing as wep5622, have used it for years. works like a charm.
| |||||
|
| Silver Member |
Updating to add that I had a second report where I had to display different formats and I used wep5622's solution and it worked beautifully!! WebFOCUS 8204 Windows, All Outputs | |||
|
| Powered by Social Strata |
| Please Wait. Your request is being processed... |
|
Focal Point Forums
WebFOCUS/FOCUS Forum on Focal Point
[SOLVED] Different Formats in 1 field??
