Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Different Formats in 1 field??
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] Different Formats in 1 field??
 Login/Join
 
Silver Member
posted
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 8.1.05M AppStudio, 8202M AppStudio
Windows, All Outputs
 
Posts: 34 | Registered: March 21, 2014Reply With QuoteReport This Post
Platinum Member
posted Hide Post
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 Minutes 

This 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
 
Posts: 181 | Location: Infobuild India | Registered: August 28, 2015Reply With QuoteReport This Post
Virtuoso
posted Hide Post
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
END


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1547 | Location: Enschede, Netherlands | Registered: August 12, 2010Reply With QuoteReport This Post
Virtuoso
posted Hide Post
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 7.7.05M, 8.1.05M, 8.2.0.1M gen240 Windows, HTML, Excel, PDF
In Focus since 2007
 
Posts: 1678 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Silver Member
posted Hide Post
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 8.1.05M AppStudio, 8202M AppStudio
Windows, All Outputs
 
Posts: 34 | Registered: March 21, 2014Reply With QuoteReport This Post
Expert
posted Hide Post
i use the same thing as wep5622, have used it for years. works like a charm.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Reply With QuoteReport This Post
Silver Member
posted Hide Post
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 8.1.05M AppStudio, 8202M AppStudio
Windows, All Outputs
 
Posts: 34 | Registered: March 21, 2014Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Different Formats in 1 field??

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.