Brian Dunning's FileMaker Custom Functions

Validate_Generate_CNPJ ( fnType ; CNPJ )

A variation of Francisco Carlos Otani's

  Average rating: 4.3 (41 votes) Log in to vote

Edward Souza   Edward Souza
Duana A.S. Designs, LLC

Share on Facebook Share on Twitter

  Sample input:
Validate_Generate_CNPJ ( 1 , 123456789123 )
  Sample output:

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

The Brazilian Government IRS employs a Modulus 11 Algorithm variation to calculate a tax-oriented cadastral number -- compulsory to all companies countrywide -- entitled "CNPJ".
Francisco Carlos Otani wrote a useful CF ( to validate the cadastral number checksum digits, which are the last two of a series of 14 numerical digits. Looking at Otani's CF code, I realized it could be restructured modularly; it would be concurrently conciser and more abstract, hence used as the starting point to another Modulus 11 Algorithm variation. Also, since it validated checksum numbers, the CF could as well spawn them.



Log in to post comments.


Note: these functions are not guaranteed or supported by 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 16 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: