Kbase P135742: Duplicate records created in XML file with non-unique index
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/6/2008 |
|
Status: Unverified
SYMPTOM(s):
The following code causes duplicate records to be created in an XML file:
DEFINE TEMP-TABLE tmp-order XML-NODE-NAME "Order"
FIELD Cust-Num AS INTEGER FORMAT ">>>>9" XML-NODE-NAME "CustNum"
FIELD Order-num AS INTEGER FORMAT ">>>>9" XML-NODE-NAME "OrderNum"
FIELD Terms AS CHARACTER FORMAT "x(20)" INITIAL "Net30"
INDEX tmp_p IS PRIMARY UNIQUE Order-num.
DEFINE TEMP-TABLE tmp-customer XML-NODE-NAME "Customer"
FIELD Cust-Num AS INTEGER FORMAT ">>>>9" XML-NODE-NAME "CustNum"
FIELD Name AS CHARACTER FORMAT "x(20)"
FIELD Terms AS CHARACTER FORMAT "x(20)" INITIAL "Net30"
INDEX tmp_p IS PRIMARY /* UNIQUE */ Cust-Num.
DEFINE DATASET ds-order
FOR tmp-Order, tmp-Customer
DATA-RELATION order-customer FOR tmp-order, tmp-customer
RELATION-FIELDS (cust-num, cust-num) NESTED.
XML file created from dataset with WRITE-XML
Nested option used in data-relation
Does not happen when index is unique
FACT(s) (Environment):
Windows
UNIX
OpenEdge 10.1x
CAUSE:
The data is duplicated in the temp-table. There is a similar query to for each order, each customer of order.
So when the fill runs, for each order, it will fill the customer table. If there's more than one order for the customer, duplicate customer records will be created (unless there is an unique index on some field).
FIX:
If the field needs to be left as non-unique, a BEFORE-ROW-FILL callback on the customer table can be created that returns no-apply when the record is already on the table."