Focal Point
[SOLVED] data format issue with decimal

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

September 19, 2011, 07:31 AM
raghuram
[SOLVED] data format issue with decimal
Hi all,
We have currency column with data type (number) in Dbase.
When I pull the data from the dbase value is showing with 4 decimals (e.g 0.16754).
But when I am trying to pull the data from Web focus environment as below, it showing the data with two decimals.
ENGINE SQLORA SET DEFAULT_CONNECTION &SEL_DSN
ENGINE SQLORA
SELECT CURRENCY FROM CUR_TABLE;
TABLE FILE SQLOUT
PRINT *
END
-EXIT
I need to show the data till 4 deciamls.
Could you please suggest, how can i do this?
Thanks,
Raghu

This message has been edited. Last edited by: Kerry,


WebFOCUS 7.6.7
Windows
Excel, PDF, HTML
September 19, 2011, 05:29 PM
Waz
What is the format of the column in Oracle ?

If you add ?FF after TABLE FILE SQLOUT, what is shown ?


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

September 20, 2011, 03:03 AM
raghuram
Hi Waz,
Thanks for your response.
Format of the column in Oracle is Number,
After adding ?FF in TABLE FILE SQLOUT,It is showing D20.2

Thanks,
Raghu


WebFOCUS 7.6.7
Windows
Excel, PDF, HTML
September 20, 2011, 04:27 PM
Waz
I think WebFOCUS is getting confused with the format, are you able to force the format to what you want in the SQL, then it should come through OK.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

September 20, 2011, 05:55 PM
Dan Satchell
I believe the standard WebFOCUS conversion for a plain number field in Oracle is D20.2. I think you will need to define your Oracle currency column as something like number(9,4) in order for WebFOCUS to assign more decimals to the converted column.


WebFOCUS 7.7.05
September 23, 2011, 03:46 PM
raghuram
Hi Waz,
i tried to force the data type to D20.6 but it is showing the same as .1300 instead of .1345


WebFOCUS 7.6.7
Windows
Excel, PDF, HTML
September 23, 2011, 04:14 PM
Tom Flynn
ENGINE SQLORA SET DEFAULT_CONNECTION &SEL_DSN
ENGINE SQLORA
SELECT
TO_CHAR(CURRENCY,'$999,999,999,999,999.9999') "Currency" FROM CUR_TABLE
;

TABLE FILE SQLOUT
PRINT *
END
-EXIT


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
September 23, 2011, 06:54 PM
njsden
SQL SQLORA
SELECT 12345.678912 AS NUM FROM DUAL;
TABLE FILE SQLORA
PRINT NUM
END


Result -> 12,345.68 Mad

SQL SQLORA
SELECT CAST(12345.678912 AS NUMBER(16,6)) AS NUM FROM DUAL;
TABLE FILE SQLORA
PRINT NUM
END


Result -> 12345.678912 Smiler



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
September 23, 2011, 07:03 PM
njsden
If we HOLD the results from the script above we can see that WF now sees the data retrieved as P18.6 instead of the default D20.2, therefore keeping the precision closer to what you need:

0DEFINITION OF HOLD FILE: HDATA
0FIELDNAME                         ALIAS         FORMAT
 NUM                               E01           P18.6       MISSING = ON


Hope this helps.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
September 24, 2011, 05:36 PM
dbeagan
I had this issue last week. Went to Adapter Administration for UNIX, Windows, OpenVMS, i5/OS, and z/OS (DN4501040.1110). On page 1669 is the Oracle section How to Override the Default Precision and Scale. Based on this, I tried:

ENGINE SQLORA SET CONVERSION FLOAT PRECISION 24 8

This produced the desired precision.


WebFOCUS 8.2.06
September 26, 2011, 08:39 AM
jgelona
I'm not sure why WebFOCUS allows D20 when the documentation says that D format allows for 15 significant digits. Packed fields (P format) allows 31 digits. Maybe an IBI person can answer that.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
September 26, 2011, 08:46 AM
njsden
quote:
ENGINE SQLORA SET CONVERSION FLOAT PRECISION 24 8

Cool! I wish I'd read that manual before Roll Eyes



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
September 26, 2011, 09:19 AM
raghuram
Yes...it is working with ENGINE SQLORA SET CONVERSION FLOAT PRECISION 24 8

Thanks...


WebFOCUS 7.6.7
Windows
Excel, PDF, HTML