Unique number
Hello, I have several tables (médical vacuums, défibrilators...), in each table there are the different devices referenced by an internal N°. 
I am looking for a formula to check that the internal N° is unique, this formula works if I duplicate the internal N° on one base but does not work with the other bases
I hope I have been clear in my request
thanks
alain
8 replies
- 
  ? 
 
- 
  I don't know if this is what you entended, but if the test fails on one of the ifstatements none of the followingifstatements will execute.
- 
  You are right. 
 in fact i would like to scan several tables to see if the number i just created already exists.
- 
  Right, but I think my definition of a failed test is different than yours. When the ifstatement test condition fails or returns false, none of the code inside thatifstatement is executed so none of the nestedifstatements following that one will execute. Each one will need to be in its ownif-then-endstructure and not nested the way you have it.
- 
  thank you for your return, I will deepen if-else-then.. basically my problem is looking for a number that could be duplicated on other tables .. i don't know how to scan the other tables. if you have any suggestions. alain 
- 
  If you want to check multiple tables, you can't use nested ifstatements and you can't useelse. You need to test each table individually...let myField1 := 'N° interne';if cnt(select Aspirateur where 'N° interne' = myField1) > 0 thenalert("Ce N° interne existe déja!)end;if cnt(select Bistouri where 'N° interne' = myField1) > 0 thenalert("Ce N° interne existe déja!)end;if cnt(select Défibrillateur where 'N° interne' = myField1) > 0 thenalert("Ce N° interne existe déja!)endetc... 
- 
  I would modify the alerts to include the table names so you know which table(s) has/have a match. let myField1 := 'N° interne';if cnt(select Aspirateur where 'N° interne' = myField1) > 0 thenalert("Ce N° interne existe déja en table Aspirateur!)end;if cnt(select Bistouri where 'N° interne' = myField1) > 0 thenalert("Ce N° interne existe déja en table Bistouri!)end;if cnt(select Défibrillateur where 'N° interne' = myField1) > 0 thenalert("Ce N° interne existe déja en table Défibrillateur!)end
- 
  thank you, it works perfectly. It's a small step for you but a leap for me. 
Content aside
- 5 yrs agoLast active
- 8Replies
- 1095Views
