Brian Dunning's FileMaker Custom Functions

Validate_CPF ( _Num )

Validate Brazilian CPF number

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

FCO   FCO
FCO

Share on Facebook Share on Twitter

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

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

Description:
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.

Input:
the eleven numeric digits for a CPF number

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

Examples:
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) ).

 

Comments

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.
Abraços.
 
Joan Dagostino   Joan Dagostino, DF
Sep 8, 2014
wwfw
 
kelly   kelly, Brazil
Sep 12, 2014
hi
 
Yulia   Yulia, Brazilia
Oct 1, 2014
i need this number
 
mickey   mickey, SP
Jun 14, 2015
dd
 

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.

Under construction. Email me your wish list for improvements.