none
duplicate record using 2 fields for unique index

    Question

  • I have entity which consist of 2 fields (with unique index ticked) to generate unique record text+number, however how it is possible that somehow in the database there is duplicate text+number combination?

    Thank you for your insight.


    Wednesday, January 30, 2013 9:46 AM

All replies

  • Where these records by accident already present BEFORE you activated the unique index on the 2 fields? 

    I use intensively unique indexes on combinations of fields, and this always works as designed.

    Just to be sure: you are aware of the fact that the "combination" of the 2 fields will be unique, not the 2 fields individually.

    I would suggest that you delete all records in the table and simply try again.


    paul van bladel

    Wednesday, January 30, 2013 10:14 AM
  • Hi Paul,

    the unique indexes has been ACTIVATED on design time BEFORE inserting any records.

    yes I am aware that using 2 unique indexes combines the fields as unique.

    I have further investigated the issue and it only happens if the number field is ticked as required.

    However I use on inserting event to generate number.

    But I tried this with when the field is not ticked as required and when I tried to insert the record I received warning that there is already existing record with same indexes.

    Thanks.

    Wednesday, January 30, 2013 10:36 AM