Roger Blanchard
413 posts
Registered:
29 Jun 2018
24 Mar 2020
Link to this post
I am using a dataset model class to create/update records in a table. I am getting a bunch of conflicting record errors. I have no idea as to why. Do you see an issue with the usage of that class in the internal procedure below?
[20/03/24@09:06:53.770-0400] P-011436 T-010320 1 4GL ORS_ERR An Progress.Lang.AppError has occurred:
[20/03/24@09:06:53.770-0400] P-011436 T-010320 1 4GL ORS_ERR Error received from procrebatecustomermaint.r A conflicting RebateCustomer record already exists with CustomerNum 40037590 RebateId "19"!
[20/03/24@09:06:53.770-0400] P-011436 T-010320 1 4GL ORS_ERR Table: eRebateCustomer
[20/03/24@09:06:53.770-0400] P-011436 T-010320 1 4GL ORS_ERR
/* ********************** Internal Procedures *********************** */
PROCEDURE ProcessAddUpdate PRIVATE:
/*------------------------------------------------------------------------------
Purpose:
Notes:
------------------------------------------------------------------------------*/
DEFINE VARIABLE oRebateCustomer AS Osprey.Pos.RebateCustomer.RebateCustomerDatasetModel NO-UNDO.
DO ON ERROR UNDO, THROW:
/* Roger Blanchard / Osprey Retail Systems Nov 6, 2019
new our class and use OVERLOAD to find RebateCustomer using CustomerNum and RebateId during instantiation
*/
oRebateCustomer = NEW Osprey.Pos.RebateCustomer.RebateCustomerDatasetModel (dCustomerNum,
cRebateId
).
oRebateCustomer:TrackingChanges = TRUE.
IF NOT oRebateCustomer:RebateCustomer:Available THEN
DO:
oRebateCustomer:RebateCustomer:Create().
oRebateCustomer:RebateCustomer:CustomerNum = dCustomerNum.
oRebateCustomer:RebateCustomer:RebateId = cRebateId.
END.
oRebateCustomer:RebateCustomer:BufferHandle:BUFFER-COPY(hQuery:GET-BUFFER-HANDLE(1),
"CustomerNum,RebateId" // except list as we already assigned above
).
oRebateCustomer:SaveChanges().
CATCH e AS Progress.Lang.Error:
UNDO, THROW e.
END CATCH.
FINALLY:
DELETE OBJECT oRebateCustomer NO-ERROR.
END FINALLY.
END.
END PROCEDURE.