Kbase P43608: Getting Error 132 When Using the ProDataSet
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  16/10/2008 |
|
Status: Unverified
FACT(s) (Environment):
OpenEdge 10.0A
SYMPTOM(s):
<Buffer> already exists with <value>. (132)
Fill got error -1 creating record <buffer>
Getting Error 132 When Using the ProDataSet
CAUSE:
The default mode for filling the dataset on each buffer is the Append mode:
APPEND Default value.
A fill adds records without comparing to existing records.
Duplicates are developer responsibility. Appropriate for simulating batching.
More efficient than merger, if there are no duplicates.
EMPTY Empty data before filling
MERGE Appends unique records. Ignores updates to existing records.
NO-FILL Do not fill this table when higher table is refilled.
For example state table doesn't need to refill when a new set of address is filled.
If a buffer has been defined against a temp-table with an index that enforces uniqueness then the 132 error is raised as the append has encountered a duplicate value. This is expected behavior.
For example, in this code the ba001 temp-table has a unique index however during the fill of the dataset the buffer attempts to write two values that are duplicates (note the final aa270 record also has a cdorg value of '1002'.:
DEFINE TEMP-TABLE aa270 NO-UNDO
FIELD cdadmin AS CHARACTER
FIELD cddeb AS CHARACTER
FIELD cdorg AS CHARACTER
INDEX pkey AS PRIMARY UNIQUE
cdadmin
cddeb.
DEFINE TEMP-TABLE ba001 NO-UNDO
FIELD cdorg AS CHARACTER
FIELD naamorg AS CHARACTER
INDEX pkey AS PRIMARY UNIQUE
cdorg.
CREATE aa270.
ASSIGN aa270.cdadmin = "99"
aa270.cddeb = "1001"
aa270.cdorg = "1001".
CREATE aa270.
ASSIGN aa270.cdadmin = "99"
aa270.cddeb = "1002"
aa270.cdorg = "1002".
CREATE aa270.
ASSIGN aa270.cdadmin = "99"
aa270.cddeb = "1003"
aa270.cdorg = "1003".
CREATE aa270.
ASSIGN aa270.cdadmin = "99"
aa270.cddeb = "1004"
aa270.cdorg = "1002".
CREATE ba001.
ASSIGN ba001.cdorg = "1001"
ba001.naamorg = "Organization 1001".
CREATE ba001.
ASSIGN ba001.cdorg = "1002"
ba001.naamorg = "Organization 1002".
CREATE ba001.
ASSIGN ba001.cdorg = "1003"
ba001.naamorg = "Organization 1003".
DEFINE TEMP-TABLE debtorTT LIKE aa270.
DEFINE TEMP-TABLE orgTT LIKE ba001.
DEFINE QUERY debtorQry FOR aa270.
DEFINE DATA-SOURCE debtorDS FOR QUERY debtorQry.
DEFINE DATA-SOURCE orgDS FOR ba001.
DEFINE DATASET debtorDS FOR debtorTT, orgTT
DATA-RELATION debtor2Org FOR debtorTT, orgTT RELATION-FIELDS(cdorg, cdorg).
QUERY debtorQry:QUERY-PREPARE("FOR EACH aa270 where aa270.cdadmin = '99' no-lock":U).
BUFFER debtorTT:HANDLE:ATTACH-DATA-SOURCE(DATA-SOURCE debtorDS:HANDLE,?,?,?).
BUFFER orgTT :HANDLE:ATTACH-DATA-SOURCE(DATA-SOURCE orgDS:HANDLE,?,?,?).
DATASET debtorDS:FILL().
DEF VAR h AS HANDLE.
h = BUFFER debtorTT:GET-CHILD-RELATION(1):QUERY.
FOR EACH debtorTT NO-LOCK:
DISPLAY debtorTT.cdadmin debtorTT.cddeb debtorTT.cdorg.
h:QUERY-OPEN().
DO WHILE h:GET-NEXT():
DISPLAY orgTT.cdorg orgTT.naamorg.
END.
END.
FIX:
Ensure the fill-mode for the buffer is appropriately set. Usually 'Merge' will resolve the issue as this will simply append unique records and not report duplicate records.
In this example the following is required:
...
BUFFER orgTT:FILL-MODE = "MERGE".
DATASET debtorDS:FILL()
...