Fidalguito Posted July 13, 2019 Posted July 13, 2019 Hello! I am building a database and came up this little problem can help. The identification number is composed of 9 digits, the first 8 digits being in series and the last one is digit check based on the algorithm of Luth, that is, instead of confirming and manually entering the identification number, there would be no a calculation / script that when creating a new record it created an identification number with the requirements above. Here is an example: 19510889 2 19510890 0 19510891 4 Thank you,
OlgerDiekstra Posted July 13, 2019 Posted July 13, 2019 Have a look on the Brian Dunning website: https://www.briandunning.com/cf/87 That's just one of them. Searching for 'Luhn' will return a few more hits.
comment Posted July 14, 2019 Posted July 14, 2019 (edited) Your requirement is not clear. First , I don't know what "the algorithm of Luth" is. If you meant the Luhn algorithm, then your examples don't make sense, because the expected results would be: 19510889 9 19510890 7 19510891 5 Please clarify. - and no less importantly, please update your profile so that we know which version and OS you're using. Edited July 14, 2019 by comment
Fidalguito Posted July 14, 2019 Author Posted July 14, 2019 Hello! My System is Windows 10 and the version is Filemaker Advanced 18. I would like if possible that the first 8 numbers were a predefined series (eg 19510889), then Filemaker would compute and add the check digit (eg 9) to the field. That is, in the ID field (ex.) It appeared at the end 19510889 9 In other words, when creating a new registry it would automatically put the serial number + the verification digit Examples: John ID - 19510889 9 Steve ID - 19510890 7 Alex ID - 19510891 5 The verification digit is based on the Luhn algorithm. Thank you for your support.
comment Posted July 14, 2019 Posted July 14, 2019 I would use two fields for this: a SerialID field auto-entering a serial number (you can set the starting value at any number), and a calculation field (result is Number) = While ( [ number = SerialID ; odd = True ; sumDigits = 0 ] ; number ; [ digit = Mod ( number ; 10 ) ; value = digit * ( odd + 1 ) ; value = If ( value > 9 ; value - 9 ; value ) ; sumDigits = sumDigits + value ; number = Div ( number ; 10 ) ; odd = not odd ] ; 10 * SerialID + Mod ( 9 * sumDigits ; 10 ) )
OlgerDiekstra Posted July 16, 2019 Posted July 16, 2019 If I may ask, what's the purpose of using such ID's? How do you plan to use this?
Fidalguito Posted July 16, 2019 Author Posted July 16, 2019 Hello! Many thanks to the formula works very well. The numbers will be used for military identification.
Recommended Posts
This topic is 1956 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now