AX Slave - OnAfterGetRecord() // Save the last entry ID before TempAXSlave.RESET; IF TempAXSlave.FINDLAST THEN EntryID := TempAXSlave.SlaveID + 1 ELSE EntryID := 1; TempAXSlave.SETRANGE(AccountNumber,"AX Slave".AccountNumber); TempAXSlave.SETRANGE(CaseID,"AX Slave".CaseID); TempAXSlave.SETRANGE(InsuranceCompanyName,"AX Slave".InsuranceCompanyName); IF TempAXSlave.FINDFIRST THEN BEGIN TempAXSlave.MaxResults += 1; TempAXSlave.MODIFY; END ELSE BEGIN TempAXSlave.INIT; //SlaveID += 1; TempAXSlave.SlaveID := EntryID; // Put here the entry ID TempAXSlave.AccountNumber := "AX Slave".AccountNumber; TempAXSlave.CaseID := "AX Slave".CaseID; TempAXSlave.InsuranceCompanyName := "AX Slave".InsuranceCompanyName; TempAXSlave.INSERT; END;
Answers
I will search the last ID before everything so I am sure that if I do an insert if have the last ID and I won't overwrite the record or worse, get an error.
But the I think that real problem is that, when you do the FINDSET in the AX Slave - OnPostDataItem() your are doing a RESET before right? Because I will keep your SETRANGE filters and for that reason on the FINDSET it will find only one record. Probably the last of your list.
Thank you. I really appreciate