Raj
Raj

Reputation: 85

Duplicate record getting inserted in Target table while importing data using DMF/DIXF AX 2012 R2

I have a table.

TableMain which has two fields. Field1: VendRecId Field2: TestRecId

which stores recids of tables Vendtable, TestTable.

Tablemain has no Index.

I am importing data into MainTable using DIXF/DMF. Its importing fine. When I kept duplicate data in the file while importing. It created new record instead of updating. Could you please let me know how to do such that it will update instead of inserting duplicate record.

I am not supposed to modify the TableMain

Upvotes: 1

Views: 1513

Answers (1)

Raj
Raj

Reputation: 85

I am able to resolve it using InsertUpdate method in the TableMain entity Class. In insertupdate method check the values from target buffer and see if record exists in TableMain. If yes, then modify callinsertlogic to false, else make it true.

TableMain tableMain;

select RecId from tableMain where tableMain .Field1 == target.fiedl1 && tablemain.field2 == target.field2;

if(tablemain.recid) Callinsertlogic = false; else callinsertlogic = true;

then call the super method ret = super( ..,callinsertlogic,..).

This worked for me.

Using this way I can do insert if record is new, update if existing record, without adding index in tablemain.

Upvotes: 1

Related Questions