Focal Point
[CLOSED] formatting a double in DM

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

August 31, 2009, 03:09 PM
MacLonghorn
[CLOSED] formatting a double in DM
I'm trying to do a subreport where a list of comments shows for a detail record if they're available. To do this, I'm SAVing some output, and looping through the records to display the main records of my report (it contains a Company and an Amount, among other things). Then based on the Company, if there are comments for the Company, I'm displaying a small subreport that generates HTMTABLE output. Everything works fine, but I'm having a problem formatting the Amount from the SAVE file.

The master file defines the Amount as D12.2C. My read looks like:
-READ SAVEFIL NOCLOSE &COMPANY.A50. &AMOUNT.A20.

When I show Amount, it's got the decimal but no commas. I've tried ATODBL(&AMOUNT,'&AMOUNT.LENGTH','D12.2C') but it removes the decimal and doesn't do commas. How can I work around this? Can I read from a HOLD file? If so, what's the -READ syntax?

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


Thanks.

Mark
WF 7.6 Windows
September 01, 2009, 02:57 AM
GamP
You READ syntax is perfectly in order. The fact that you don't see comma's is because the save does not put them in the file. The comma option is for display purposes only, it will not be ported to a normal hold (or save) file. This will be done with other format like doc or wp. Your holdfile will look a little bit different with either option, but it is considered to be a display format, so it will contain the comma's. I'm sure if you experiment a little with it, you'll find out the correct code to do what you need to do.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
September 01, 2009, 04:30 AM
Danny-SRL
Mac,

I would do the opposite.
Since you are saving the output of the amount you could use COMPUTE and output the computed field
COMPUTE OUTAMAOUNT/A16=FTOA(AMOUNT, '(D12.2C)', 'A16');



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

September 01, 2009, 06:41 AM
GamP
Yes Danny, your solution to this looks like it is a better one to me too.
Never thought of doing it like this.

Mac - go with this!


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
September 01, 2009, 10:14 AM
MacLonghorn
Excellent, I'll give that a shot. Thank you both.


Thanks.

Mark
WF 7.6 Windows