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
if
statements none of the followingif
statements 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
if
statement test condition fails or returns false, none of the code inside thatif
statement is executed so none of the nestedif
statements following that one will execute. Each one will need to be in its ownif-then-end
structure 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
if
statements 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 then
alert("Ce N° interne existe déja!)
end;
if cnt(select Bistouri where 'N° interne' = myField1) > 0 then
alert("Ce N° interne existe déja!)
end;
if cnt(select Défibrillateur where 'N° interne' = myField1) > 0 then
alert("Ce N° interne existe déja!)
end
etc...
-
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 then
alert("Ce N° interne existe déja en table Aspirateur!)
end;
if cnt(select Bistouri where 'N° interne' = myField1) > 0 then
alert("Ce N° interne existe déja en table Bistouri!)
end;
if cnt(select Défibrillateur where 'N° interne' = myField1) > 0 then
alert("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
- 4 yrs agoLast active
- 8Replies
- 1087Views