Focal Point
[SOLVED] Numeric (packed or decimal) to Alpha

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

December 16, 2009, 01:45 PM
Amber
[SOLVED] Numeric (packed or decimal) to Alpha
I am trying to change a numeric format to alpha. The format in the file is P12.3 (ie. 69.23 ) I need this filed to be 8 characters long; so I am trying to change the format to A8. I have tried
ALPHA/A8=PTOA(PACKED, '(P13.2)', 'A8'); and the output was blank.
I was able to change the format to D8.2. Then I tried ALPHA/A8=FTOA(PACKED, '(D8.2)', 'A8'); and the output was .00. I've even tried edit, but then I just get 00000000. What am I doing wrong? I know the field isn't blank, because when I print the field there is data in it; and when I print the D8.2 format, the same data is in it. What do I need to do to change it to alpha or at least specify the output to always be 8 characters in length. Thanks!

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


WebFOCUS 768
OS/400
HTML, also quite a few active reports and excel.
December 16, 2009, 02:29 PM
mrguru
Your output field is too small. Try A17 with the P12.3 or A12 with D8.2...

This is from the documentation:

Alphanumeric
Is the name of the field that contains the result, or the format of the output value
enclosed in single quotation marks. The length of this argument must be greater than
the length of number and must account for edit options and a possible negative sign.


WF 8.2.01M
8.2.01M Reporting Server
Windows 2012 Srvr R2
PDF,Excel, HTML
Graphs - a lot of graphs
December 16, 2009, 04:03 PM
Waz
Using PTOA with the format P12.3 will give you output of 12 chars. its all in the edit options on the field.

C will add commas, M will add the char $, etc

If you know that the size of the number will be less than 9 characters, including formatting characters, Then use 8.3.


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!

December 17, 2009, 01:18 AM
Danny-SRL
quote:
ALPHA/A8=PTOA(PACKED, '(P13.2)', 'A8');


As was said, you have to account for the length of the field. So:
  
ALPHA/A8=EDIT(PTOA(PACKED, '(P13.2)', 'A13'),'$$$$$99999999');



Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

December 17, 2009, 10:55 AM
Amber
mrguru and Danny-SRL, my output was .00. Waz, that worked! Since I didn't want 3 character right of the decimal, I tried 9.2, but that gave me 9 characters in lenght. Then I tried 8. 2 and that worked. Thanks for all your help!!


WebFOCUS 768
OS/400
HTML, also quite a few active reports and excel.