How would I check to see if my SKU text field is unique and that no other values SKU of that value is in the table?
P

Hi there,

I have a table called Product with a Text Field called SKU how would i check that the value of the new or updated SKU is unique and does not already exist within the table?

On a second note would there be anyway of randomly generating an SKU of six digits i.e 123456 that odes not already exist in the SKU field?

Any help appreciated

 

Regards

 

Paul

Capture

N

One simple way to check for duplicates (formula field)

 

let d := SKU;

cnt((select Product where SKU = d).SKU)

 

Where the result is 2 it's double...

P

Many thanks Nick I will give it a try.

P

I have used the following code in both trigger on create and update but no warning is displayed, is there something i am doing wrong?

let d := SKU;
let countSKU := cnt((select Product where SKU = d).SKU);
if countSKU > 1 then alert("Duplicate!") end

N

@Paul

Read this topic:

https://ninoxdb.de/en/forum/technical-help-5ab8fe445fe2b42b7dd39ee7/how-i-can-prevent-duplicate-records-being-added-5b7697059efc8227533e7d76

Reply