Brian Dunning's FileMaker Custom Functions

StateAbbrev ( state )

Given a USA or Canadan state name, returns corresponding two letter USPS code

  Average rating: 4.6 (23 votes) Log in to vote

L. Allen Poole   L. Allen Poole - Show more from this author
Creative Database Solutions NW
http://cdsnw.com

Share on Facebook Share on Twitter

  Sample input:
Wyoming
  Sample output:
WY

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

If state name is not recognized, it's returned verbatim.

 

Comments

François Goulet   François Goulet, Montreal, QC Canada
Dec 12, 2014
Hi Allen,
It looks like you forgot the canadian province of New-Brunswick in your CF...

FYI, in Canada we have 2 official languages - French and English. French is predominant in the province of Quebec (population: 8 million - about 23% of the total canadian population). Since I often have to create multilingual UIs I modified your custom function to integrate the french version of the provinces names...Hence the following changes in the "state" items :

state = "British Columbia" or state = "Colombie-Britannique"; "BC";
state = "Prince Edward Island" or state = "Île-du-Prince-Édouard"; "PE";
state = "New Brunswick" or state = "Nouveau-Brunswick"; "NB";
state = "Nova Scotia" or state = "Nouvelle-Écosse" ; "NS" ;
state = "Quebec" or state = "Québec" ; "QC" ;
state = "Newfoundland and Labrador" or state = "Terre-Neuve-et-Labrador" ; "NL" ;
state = "Northwest Territories" or state = "Territoires du Nord-Ouest" ; "NT" ;

Please note that other canadian provinces are the same in french as in english...

Thanks for your CF and have a great day,

François
 
L. Allen Poole   L. Allen Poole, Creative Database Solutions NW
Nov 1, 2022
Merci bien François!
 

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.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 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: