Validate_CNPJ ( _Num )
Validates Brazilian CNPJ number
Average rating: 4.2 (31 votes) Log in to vote
FCO FCO |
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
Description:
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.
Input:
the fourteen numeric digits for a CNPJ number
Output:
-3 (parameter is empty)
-2 (number of digits <> 14)
-1 (incorrect entry)
1 (OK)
Examples:
lnput: Validate_CNPJ (11222333000181)
Output: 1
lnput: Validate_CNPJ ("11.222.333/0001-81")
Output: 1
You can modify the Case result numbers to return a Boolean calculation, so that the function could be tested as GetAsBoolean ( Validate_CNPJ (_Num) ).
Comments
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.