0

Avoiding duplication in a field

Dear all,

I hope you're well. I have a field to which I assign a unique value for each record. If this field has XYZ as value, no other field in the database should also have XYZ.

Is there a function built into Ninox to help with this? Maybe a message displaying if two fields have the same value (the same that can be set if the field has more than a certain number of characters, for example)?

Thanks in advance.

Best,
Giovanni

2 replies

null
    • Mel_Charles
    • 3 yrs ago
    • Reported - view

    Giovanni

    There is no build in function to test a dupicate key field.

    Don't know the name of your field or what table, but I use this to test to test CustID (field) in my 'Customers' Table

    you should be able to follow this (myField) is a variable. So if  try to enter the same customer code into a new custoer car. the alert pops uop to warn me and clears the field

    you can run this form a button. for static testing or even put it into formula field. I'll give you both examples!

    let myField := Custid;
    if cnt(select Customers where Custid = myField) > 1 then
    alert("This Account Code Already Exists ! , Please enter another one!");
    Custid := null
    end

    Here is another sample where I put the script into a formula field (this is better cos it it is always live!!!)

    let a := upper(Custid);
    if cnt((select Customers)[upper(Custid) = a]) > 1 then
    styled("A/c Code is in use !", "red")
    end

    Just replace CustID for your field name and Customers for your table name

    Good luck

    Mel

    • Giovanni_Zagarella
    • 3 yrs ago
    • Reported - view

    Hi Mel,

    Thanks so much, your formula works wonderfully. I already adopted the second option in my database.

     

    Thanks again, very appreciated!

     

    Best,
    Giovanni

Content aside

  • 3 yrs agoLast active
  • 2Replies
  • 229Views