Kbase P130384: How to output a decimal or integer field with a specific format in the output XML file created by WR
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  4/11/2008 |
|
Status: Unverified
GOAL:
How to output a decimal or integer field with a specific format in the output XML file created by WRITE-XML method?
FACT(s) (Environment):
OpenEdge 10.1B
Windows
Unix
FIX:
Use a character shadow column in the temp-table to store the formatted values and set the original column HIDDEN for XML-NODE-TYPE.
DEFINE TEMP-TABLE ttCust
FIELD decFld AS DECIMAL
DECIMALS 4
XML-NODE-TYPE "HIDDEN"
FIELD decStrFld AS CHARACTER
FIELD intFld AS INTEGER
FORMAT "999"
XML-NODE-TYPE "HIDDEN"
FIELD intStrFld AS CHARACTER
.
CREATE ttCust.
ASSIGN ttCust.decFld = 100.1234
ttCust.decStrFld = STRING( decFld, "999.9999" )
ttCust.intFld = 1
ttCust.intStrFld = STRING( intFld, "999" )
.
The output xml for ttcust table is:
<?xml version="1.0"?>
<DSET xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ttCust>
<decStrFld>100.1020</decStrFld>
<intStrFld>001</intStrFld>
</ttCust>
</DSET>
Without the shadow columns the output is:
<?xml version="1.0"?>
<DSET xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ttCust>
<decFld>100.102</decFld>
<intFld>1</intFld>
</ttCust>
</DSET>