Validate_CNPJ ( _Num )
Validates Brazilian CNPJ number
Average rating: 4.2 (31 votes) Log in to vote
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
In Brazil there is a CNPJ (Cadastro Nacional de Pessoas Jurídicas) number which serves to identify each legal entity (company, corporation) in the country. The number composes of fourteen numeric digits, being the two last ones the checking digits.
The function calculates the two checking digits, based on the twelve preceding digits.
the fourteen numeric digits for a CNPJ number
-3 (parameter is empty)
-2 (number of digits <> 14)
-1 (incorrect entry)
lnput: Validate_CNPJ (11222333000181)
lnput: Validate_CNPJ ("11.222.333/0001-81")
You can modify the Case result numbers to return a Boolean calculation, so that the function could be tested as GetAsBoolean ( Validate_CNPJ (_Num) ).
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.