I have a data extension (Data Extensions > Lifecycle Campaigns > API Tables > Patient_Records_DB) that is used to capture send event data for one of our triggered campaigns. The send event capture is happening through the statement below. When I use the UpsertDE fuction and clear the data extension out before sending, the triggered campaign works fine. When there is data in the data extension and I use the UpsertDE function with the same data set, the triggered campaign errors out in the queue. I added the SendLogCount function to attempt to override the error, but this also errors out when the data extension already has data populated that is a match. Any thoughts?
Set @SendLog = LookupOrderedRows("Patient_Records_DB",1,"AppointmentDateTime","FamilyID",@familyid)
Set @SendLogCount = Rowcount(@SendLog)
IF @SendLogCount > 1 THEN
UpdateDE(
"Patient_records_DB",1,
"PatientID",@ApptSubscriberKey,
"PatientID",@ApptSubscriberKey,
"HOHid",@HOHid,
"PatientFirstName",@PatientFirstName,
"FamilyID",@familyid,
"AppointmentID",@FamilyAppt,
"AppointmentDateTime",@PatientApptTime,
"AppointmentTypeCode",@AppointmentTypeCode,
"RescheduleYN",@RescheduleYN,
"EventDate",@EventDate)
ELSE
InsertDE(
"Patient_Records_DB",
"PatientID",@ApptSubscriberKey,
"HOHid",@HOHid,
"PatientFirstName",@PatientFirstName,
"FamilyID",@familyid,
"AppointmentID",@FamilyAppt,
"AppointmentDateTime",@PatientApptTime,
"AppointmentTypeCode",@AppointmentTypeCode,
"RescheduleYN",@RescheduleYN,
"EventDate",@EventDate)
ENDIF
/*UpsertDE(
"Patient_Records_DB",1,"PatientID",@ApptSubscriberKey,
"PatientID",@ApptSubscriberKey,
"HOHid",@HOHid,
"PatientFirstName",@PatientFirstName,
"FamilyID",@familyid,
"AppointmentID",@FamilyAppt,
"AppointmentDateTime",@PatientApptTime,
"AppointmentTypeCode",@AppointmentTypeCode,
"RescheduleYN",@RescheduleYN,
"EventDate",@EventDate)*/
Patient_Records_DB
?