Consultor Eletrônico



Kbase P184053: Keywords as field names in dynamic temp-tables change after READ-XML and WRITE-XML of the parent Pro
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   3/14/2011
Status: Unverified

SYMPTOM(s):

Keywords as field names in dynamic temp-tables change after READ-XML and WRITE-XML of the parent ProDataSet

If the field names of a dynamically created temp-table are ABL keywords, these names will have the character '1' appended to them after WRITE-XML and READ-XML are executed against a ProDataSet containing the temp table.

The following code demonstrates the issue. Notice that the field 'REPEAT' is changed to 'REPEAT1' after WRITE-XML and READ-XML are executed against the ProDataSet containing the temp table:

DEFINE VARIABLE tableHandle AS HANDLE.
DEFINE VARIABLE sum-buffer AS HANDLE.
DEFINE VARIABLE sum-dataset AS HANDLE.
DEFINE VARIABLE import-dataset AS HANDLE.
DEFINE VARIABLE new-buffer AS HANDLE.
DEFINE VARIABLE iLoop AS INTEGER NO-UNDO.
/*creating the dynamic temp-table */
CREATE TEMP-TABLE tableHandle.
tableHandle:ADD-NEW-FIELD("REPEAT","CHARACTER").
tableHandle:TEMP-TABLE-PREPARE("SomeTable").
/* populating it with some data */
ASSIGN sum-buffer = tableHandle:DEFAULT-BUFFER-HANDLE.
sum-buffer:BUFFER-CREATE().
/* exporting to xml */
CREATE DATASET sum-dataset.
sum-dataset:ADD-BUFFER(sum-buffer).
sum-dataset:WRITE-XML("FILE","c:\temp\data.out",YES,"UTF-8",?,YES).
/*importing xml */
CREATE DATASET import-dataset.
import-dataset:READ-XML("FILE","c:\temp\data.out","empty",?,FALSE,?,"Ignore").
ASSIGN new-buffer = import-dataset:GET-BUFFER-HANDLE("SomeTable").
/* List field names of new buffer */
DO iLoop = 1 TO new-buffer:NUM-FIELDS:
MESSAGE new-buffer:BUFFER-FIELD(iLoop):NAME
VIEW-AS ALERT-BOX INFO BUTTONS OK.
END.

FACT(s) (Environment):

All Supported Operating Systems
OpenEdge 10.2B

CAUSE:

Bug# OE00205653

CAUSE:

The behavior described above is intentionalto allow static definitions to compile.

FIX:

This behaviour is by design to allow static definitions to compile. If you are not concerned about the use of bproxsdto4gl, then a workaround is to set the XML-NODE-NAME of each field to its name before the WRITE-XML method is executed. This work around will not work if you write out the xsd and use it in bproxsdto4gl because the resulting .i file will not compile. But if you aren't concerned about xsdto4gl, then the workaround is fine:


DEFINE VARIABLE tableHandle AS HANDLE.
DEFINE VARIABLE sum-buffer AS HANDLE.
DEFINE VARIABLE sum-dataset AS HANDLE.
DEFINE VARIABLE import-dataset AS HANDLE.
DEFINE VARIABLE new-buffer AS HANDLE.
DEFINE VARIABLE iLoop AS INTEGER NO-UNDO.
/*creating the dynamic temp-table */
CREATE TEMP-TABLE tableHandle.
tableHandle:ADD-NEW-FIELD("REPEAT","CHARACTER").
tableHandle:TEMP-TABLE-PREPARE("SomeTable").
/* populating it with some data */
ASSIGN sum-buffer = tableHandle:DEFAULT-BUFFER-HANDLE.
sum-buffer:BUFFER-CREATE().
/* Woraround */
DO iLoop = 1 TO sum-buffer:NUM-FIELDS:
sum-buffer:BUFFER-FIELD(iLoop):XML-NODE-NAME = sum-buffer:BUFFER-FIELD(iLoop):NAME.
END.
/* exporting to xml */
CREATE DATASET sum-dataset.
sum-dataset:ADD-BUFFER(sum-buffer).
sum-dataset:WRITE-XML("FILE","c:\temp\data.out",YES,"UTF-8",?,YES).
/*importing xml */
CREATE DATASET import-dataset.
import-dataset:READ-XML("FILE","c:\temp\data.out","empty",?,FALSE,?,"Ignore").
ASSIGN new-buffer = import-dataset:GET-BUFFER-HANDLE("SomeTable").
/* List field names of new buffer */
DO iLoop = 1 TO new-buffer:NUM-FIELDS:
MESSAGE new-buffer:BUFFER-FIELD(iLoop):NAME
VIEW-AS ALERT-BOX INFO BUTTONS OK.
END.