write-xml decimal formatting

Posted by Admin on 23-Aug-2012 10:59

Is it possible to enforce the number of decimal places when using write-xml?

e.g. Temp table has a decimal field:

define temp-table ttTab no-undo
    field partQty as decimal format "zzz,zz9.99-".

create ttTab.
assign ttTab.partQty = 200.1.

temp-table ttTab:write-xml("FILE","myfile.xml").

Resulting in XML like this:

<?xml version="1.0"?>

<ttTab xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">





Is there a method of ensuring partQty has 2 decimal places at all times e.g.?



Openedge 10.2B05, Solaris 64bit

All Replies

Posted by Admin on 23-Aug-2012 11:07

Use a character column.

Posted by Robin Brown on 23-Aug-2012 11:44

WRITE-XML recognizes the DECIMALS option on the temp-table field definition.  Adding DECIMALS 2 to the partQty definition will enforce 2 decimal places in the output.



Posted by Admin on 23-Aug-2012 12:05

Bingo thanks very much!


This thread is closed