1
votes

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

1
You mention TableMain and MainTable, are these the same thing? And I think you need a unique index in order for DIXF to know what record to update...otherwise how is it going to know what constitutes a field that needs updated or what's a key?? - Alex Kwitny
Yes, both are same. Ok. So there would be no way other than creating an index? - Raj
Well I'd have to dig into the DIXF code, but how does it know which field needs updated? If you have row 1 (1, 1) and row 2 (1,2) and you want update with data that has (1,3). How does it know if that's a new record, or you're updating one of the other rows, etc. I just don't see any logical way it can do that. - Alex Kwitny
Yes Correct. As per some restriction I am not allowed to change TableMain, So just checking if there is any otherway. Thanks for the info. - Raj

1 Answers

1
votes

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.