Column (Purchase Order No) should be unique - Form has multiple purchase order nos

Published 4 months ago by zaster

There is one form with multiple rows where you can include multiple purchase order nos. These purchase order nos should be unique. What is the method of doing it ?

Should i do the validation part from the database side(I can make it as unique field from the database side)

Snapey
Snapey
4 months ago (897,275 XP)

how do you want to handle the situation where a number is repeated?

if you just want to filter them out, you could use a unique function on the list (if you make it a collection)

If you want to return an error to the user, you can use unique and then count the uniques, then also count the original POs if the numbers are different then there was a duplicate.

You probably still need to check at the database insert because one of the numbers used could have been on a previous form

zaster

@Snapey

If you want to return an error to the user, you can use unique and then count the uniques, then also count the original POs if the numbers are different then there was a duplicate.

This is the way i need to proceed, is there anything i could refer before i could start on implementing this section

Snapey
Snapey
4 months ago (897,275 XP)

heres an article covering this approach

http://biostall.com/check-if-php-array-contains-duplicates/

You could probably create a custom validation rule to do this?

Perhaps also use the unique validation rule to check if the number is already stored

Please sign in or create an account to participate in this conversation.