Skip to main content

Posts

Showing posts with the label release update database

How can we Delete duplicate records of table in axapta

delete duplicate in axapta .If there is duplicate record in table then use this job to delete duplicate. If two name like sks and sks then one will be delete and one will remain. static void deleteduplicate(Args _args) { Set fieldSet = new set(Types::Integer); // create dictindex from the unique index DictIndex dictIndex = new DictIndex( tablenum(_RegistrationDetails), indexnum(_RegistrationDetails, Index1)); ; // these are the fields from the index // add them to a set fieldSet.add(fieldnum(_RegistrationDetails, _RegistrationNo)); // fieldSet.add(fieldnum(YourTable, YourTableFieldId2)); // set allow duplicates ReleaseUpdateDB::indexAllowDup(dictIndex); // delete duplicate records ReleaseUpdateDB::deleteDuplicatesUsingIds(tablenum(_RegistrationDetails), 0, fieldSet); // reenable index ReleaseUpdateDB::indexAllowNoDup(dictIndex); info("done"); }