Brian Dunning's FileMaker Custom Functions

Validate_CPF ( _Num )

Validate Brazilian CPF number

  Average rating: 4.1 (40 votes) Log in to vote


Share on Facebook Share on Twitter

  Sample input:
Validate_CPF ("123.456.789-09")
  Sample output:

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

In Brazil there is a CPF (Cadastro de Pessoas Físicas) number which serves to identify each individual in the country. The number composes of eleven numeric digits, being the two last ones the checking digits.

The function calculates the two checking digits, based on the nine preceding digits.

the eleven numeric digits for a CPF number

-3 (parameter is empty)
-2 (number of digits <> 11)
-1 (incorrect entry)
1 (OK)

lnput: Validate_CPF (12345678909)
Output: 1

lnput: Validate_CPF ("123.456.789-09")
Output: 1

You can modify the Case result numbers to return a Boolean calculation, so that the function could be tested as GetAsBoolean ( Validate_CPF (_Num) ).



Gabriel Teixeira   Gabriel Teixeira, Florianópolis/Brazil
Jan 18, 2013
Parabéns por compartilhar a função, já possuo uma função para este fim, mas vou armazenar esta comigo também.
Joan Dagostino   Joan Dagostino, DF
Sep 8, 2014
kelly   kelly, Brazil
Sep 12, 2014
Yulia   Yulia, Brazilia
Oct 1, 2014
i need this number
mickey   mickey, SP
Jun 14, 2015

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: