Focal Point
Formatting Decimals For Different Rows of the Same Column

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

August 02, 2007, 12:00 PM
gcarelse
Formatting Decimals For Different Rows of the Same Column
Hello,

I have data that always comes back in four rows. The first column is text and is unique. The second column is a numerical value. I need to show the numbers of the first three rows with no decimal place, but the forth row must show two decimal places. Can anyone help?


Grant


Grant
Oracle 9, Web Focus Version 7.6.1
August 02, 2007, 12:28 PM
jimster06
Grant -
Here is a link to a discussion about varying the format.

link


jimster06
DevStu WF 7.6.11
W7
HTML, PDF, EXL2K
August 02, 2007, 12:59 PM
gcarelse
Thanks for the info. I use stored procedures and not master files, so I am not sure on where I should be placing the formatting code. Here is a sample of the beginning of my fex file:

-DEFAULT &INDATE = 'DATENOW'
-DEFAULT &FMT = 'PDF'
ENGINE SQLORA SET DEFAULT_CONNECTION DATABASE_NAME
ENGINE SQLORA EX STORED_PROCEDURE_NAME '&INDATE';
-RUN
TABLE FILE SQLOUT

PRINT
PRODUCT AS ''
DAILY_AMOUNT/MYFORMAT AS 'Daily,Amount'
DAILY_PLAN/D20 AS 'Plan'
PLAN_VALUE/D20 NOPRINT
WEEKLY_AVG/D20.1 AS 'Weekly,Avg'

Where would I place the following code so that the DAILY_AMOUNT column is formatted with my custom formatting?

MYFORMAT/D20 = DECODE PRODUCT('Truck Sales' 'D20.4' ELSE 'D20.1')


Thanks,


Grant


Grant
Oracle 9, Web Focus Version 7.6.1
August 02, 2007, 01:14 PM
mgrackin
DEFINE FILE SQLOUT
quote:
MYFORMAT/D20 = DECODE PRODUCT('Truck Sales' 'D20.4' ELSE 'D20.1');

END

TABLE FILE SQLOUT
...


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
August 02, 2007, 01:49 PM
gcarelse
I now recieve this error:

FORMAT ERROR IN DECODE OR FILE ELEMENT: 'D20.2'

The PRODUCT column will always return text, so I'm not sure if this decode statement will work to try to format the other columns.


-Grant


Grant
Oracle 9, Web Focus Version 7.6.1
August 02, 2007, 01:53 PM
Francis Mariani
small typo. the define should be:

  
MYFORMAT/A8 = DECODE PRODUCT('Truck Sales' 'D20.4' ELSE 'D20.1');



Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
August 02, 2007, 02:07 PM
gcarelse
Excellent, that worked! Thanks all for all your help.


Grant


Grant
Oracle 9, Web Focus Version 7.6.1
August 02, 2007, 02:09 PM
FrankDutch
Grant

I think you need to do something with a counter in combination with the above formating function, unless the 4 the row is based upon the value of the first (text) value.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

August 02, 2007, 02:28 PM
gcarelse
Yeah, the number of decimal places depends on what the value of PRODUCT is only, so I think this will work out fine.


Grant


Grant
Oracle 9, Web Focus Version 7.6.1