Brian Dunning's FileMaker Custom Functions

CheckDigit_swissUID ( swissUID )

Generates the check digit for swiss UID / IDE / VAT number

  Average rating: 3.0 (1 vote) Log in to vote

Olivier Caulet   Olivier Caulet - Show more from this author
Helixir
http://www.caulet.ch/helixir

Share on Facebook Share on Twitter

  Sample input:
CheckDigit_swissUID ( CHE-123.456.788 )
CheckDigit_swissUID ( 10932255 )
  Sample output:
8
1

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

The swiss UID is composed of 9 numbers, randomly generated and contains no information about the enterprise (anonymous identifier). The Swiss origin of the number is indicated by the "CHE" prefix, which is the three-letter country code of the ISO 3166-1 standard. The last number refers to the check digit (C) determined by the Modulo 11 standard calculation method.
This function generates the check digit for swiss UID / IDE / VAT number

 

Comments

Christoph Kaufmann   Christoph Kaufmann, CLK.ch
Jun 17, 2019
Thank you for the function. I had to set Filemaker's language to French in order to get it recognised. For all non french speakers, here's a slightly enhancend version in English. It returns 1 (correct) or 0 (false):
Let ( [
UIDnumber = Filter ( swissUID ; "0123456789" )
;
UIDtest =

(
+ Middle ( UIDnumber ; 1 ; 1 ) * 5
+ Middle ( UIDnumber ; 2 ; 1 ) * 4
+ Middle ( UIDnumber ; 3 ; 1 ) * 3
+ Middle ( UIDnumber ; 4 ; 1 ) * 2
+ Middle ( UIDnumber ; 5 ; 1 ) * 7
+ Middle ( UIDnumber ; 6 ; 1 ) * 6
+ Middle ( UIDnumber ; 7 ; 1 ) * 5
+ Middle ( UIDnumber ; 8 ; 1 ) * 4
)
;
checkdigit = 11 - Mod ( UIDtest ; 11 )
] ;

GetAsBoolean (
Length ( uidnumber ) = 9
and
Right ( UIDnumber ; 1 ) = checkdigit
)
)
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: