Cannot Insert Second Record into Temp Table

daniel_mitrea_1995daniel_mitrea_1995 Member Posts: 8
Using a report, I have a dataItem based on Ax Slave table. On After Get Record trigger I want to check if there is already inserted the combination between customer, caseID and InsuranceCompanyName and if it's then I just increment one field. I'm using the same table Ax Slave but is a temp table

The problem is that I cannot insert more than one record in the temp table.
I have the following code:

AX Slave - OnAfterGetRecord()

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 += 1;
TempAXSlave.AccountNumber := "AX Slave".AccountNumber;
TempAXSlave.CaseID := "AX Slave".CaseID;
TempAXSlave.InsuranceCompanyName := "AX Slave".InsuranceCompanyName;
TempAXSlave.INSERT;
END;

on the AX Slave - OnPostDataItem() I want to generate an excel file based on the temp table. But when I do TempAXSlave.FINDSET I see there is only one record in that table.

Can you please help me with this problem ?

Best Answer

Answers

  • daniel_mitrea_1995daniel_mitrea_1995 Member Posts: 8
    Removing the filters did the trick. Caught up in the problem and forget the details
    Thank you. I really appreciate
Sign In or Register to comment.