Search code examples
indexingduplicatesaxaptadynamics-ax-2012x++

How to create two different Index can't duplicate?


I have in MyTable two different fields, FieldA and FieldB.

I want to create two indexes with AllowDuplicates set to No, because there should be no records with same FieldA and FieldB.

If I create two indexes for each field, it allows me nonetheless to create records with values for example FieldB same value.

Is it possible to set two different indexes for two different fields? Because these fields are independent of each other or do I have to use the code solution (validateWrite, insert, update etc.)?

See below for an example: I do not want this to happen.
Two records with same FieldB (or vice versa /conversely).

my situation

Thanks all,

enjoy!


Solution

  • You probably need to synchronize the table. Do so on the context menu of the table. You will need to delete the duplicates first!

    If still a problem, take a look on the table from SQL Enterprise Manager (it is called Studio nowadays).