If you want to avoid duplicate entries, then you must identify which attributes your business classifies as unique.
Then when saving the object, you can check with database calls if there are already objects exists in the table with those values and show validation feedback.
In the XPATH for your DB, you must make sure you skip the currently processed item as well.
This seems to be only way we can do it in Mendix.
Let Mendix check the uniqueness for you by setting a validation on the entity’s attribute that you want to be unique:
If you need the FavoriteItem to be unique based on more than one attribute, than add an extra attribute “UniqueKey” to your entity FavoriteItem, add the validation rule ‘unique’ to it and add an EventHandler “BCo_FavoriteItem” to entity FavoriteItem in which you concatenate those fields into one string and set “UniqueKey” to that value.
Securing your data’s uniqueness here at the domainlevel will get the job done without you, or any other programmer, having to build extra check-activities into the microflows.
I want to avoid duplicate commits like this for the words I have already added to favorite.
My favorite item entity