# Enforce Uniqueness/Prevent Duplicates

**URL:** <https://forums.knack.com/t/enforce-uniqueness-prevent-duplicates/8474>\
**Category:** Get Answers\
**Created:** [April 6, 2020, 8:44pm UTC](https://forums.knack.com/t/enforce-uniqueness-prevent-duplicates/8474 "2020-04-06T20:44:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JamesKeeli57915](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@JamesKeeli57915](https://forums.knack.com/u/JamesKeeli57915)\
**Post date:** [April 6, 2020, 8:44pm UTC](https://forums.knack.com/t/enforce-uniqueness-prevent-duplicates/8474/1 "2020-04-06T20:44:37Z")

</div>

How can someone require that values for combinations of two fields be unique?  
  
For example, we have a field called DrawingNumber# and a field called WorkTicketNumber. Together, these fields need to be unique:

-A record can share a DrawingNumber with other records, but each of those records must have a different WorkTicketNumber.

-A record can share a WorkTicketNumber with other records, but each of those records must have a different DrawingNumber.

-No two records can share BOTH a DrawingNumber and WorkTicketNumber.  
  
We have tried using these two fields to create text formula field that is the combination of those two fields, and using conditional rules to copy that value to a short text field that is set to be unique.  
  
It seems completely asinine that Knack doesn't have an ability to enforce uniqueness on multiple fields, or at least a way to enforce uniqueness on a text formula/combination field. I'm really trying to do this without making the process convoluted or having to use external code.

---

<div class="post-metadata">

**Author:** ![JulianKirkness](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/juliankirkness/32/770_2.png) [@JulianKirkness](https://forums.knack.com/u/JulianKirkness)\
**Post date:** [April 7, 2020, 9:36am UTC](https://forums.knack.com/t/enforce-uniqueness-prevent-duplicates/8474/2 "2020-04-07T09:36:53Z")

</div>

I quite agree that this should be a standard feature through the builder without code as it's a very common use case. I recently wrote an article about this in my blog ( [https://www.onlinedatabase.expert/blog](https://www.onlinedatabase.expert/blog) ) which shows the required Knack JS code for this (not pretty):

![](upload://ckAvG31vSx9pLZmz8hRCTVlkEy9.png)

I'm afraid I no longer have this code as text (only this screenshot).

Should be easy!
