Brian Dunning's FileMaker Custom Functions

ParseNameToJSON ( name )

Parses english-format persons name into a possibly useful JSON object

  Be the first to rate this function Log in to vote

Richard Dyce   Richard Dyce
Dyce & Sons LTD.
http://dyce.com

Share on Facebook Share on Twitter

  Sample input:
ParseNameToJSON ( "Smith" ) & ¶ &
ParseNameToJSON ( "John Smith" ) & ¶ &
ParseNameToJSON ( "Jane J Smith" ) & ¶ &
ParseNameToJSON ( "Pleydell-Smith" ) & ¶ &
ParseNameToJSON ( "June Pleydell-Smith" ) & ¶ &
ParseNameToJSON ( "Dr June Pleydell-Smith" ) & ¶ &
ParseNameToJSON ( "Frank J Pleydell Smith" ) & ¶ &
ParseNameToJSON ( "Frank J R R Pleydell Smith" ) & ¶ &
ParseNameToJSON ( "Prof. Frank J. R. R. Pleydell Smith" ) & ¶ &
ParseNameToJSON ( "J Smith" ) & ¶ &
ParseNameToJSON ( "Malcolm J Smith" ) & ¶ &
ParseNameToJSON ( "Mr J Smith" ) & ¶ &
ParseNameToJSON ( "Prof John Smith" ) & ¶ &
ParseNameToJSON ( "Miss Jane Jones" )
  Sample output:
{"forename":"","initials":"","salutation":"","surname":"Smith"}
{"forename":"John","initials":"","salutation":"","surname":"Smith"}
{"forename":"Jane","initials":"J","salutation":"","surname":"Smith"}
{"forename":"","initials":"","salutation":"","surname":"Pleydell-Smith"}
{"forename":"June","initials":"","salutation":"","surname":"Pleydell-Smith"}
{"forename":"","initials":"","salutation":"Dr","surname":" June Pleydell-Smith"}
{"forename":"Frank","initials":"J","salutation":"","surname":"Pleydell Smith"}
{"forename":"Frank","initials":"J R R","salutation":"","surname":"Pleydell Smith"}
{"forename":"","initials":"","salutation":"Prof","surname":" Frank J R R Pleydell Smith"}
{"forename":"","initials":"J","salutation":"","surname":"Smith"}
{"forename":"Malcolm","initials":"J","salutation":"","surname":"Smith"}
{"forename":"","initials":"","salutation":"Mr","surname":" J Smith"}
{"forename":"","initials":"","salutation":"Prof","surname":" John Smith"}
{"forename":"","initials":"","salutation":"Miss","surname":" Jane Jones"}

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

This parses a name string into a JSON object.

It is aimed at English formats (because this is what I know best, sorry!), but could probably be extended to other European situations by changing the salutations list.

Example use case: via a trigger script take a simply global entry field and populate separated customer name fields.

Please let me know about any corrections.

 

Comments

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.