👪 Parse Full Name

Options
Danny Roden
Danny Roden Administrator
edited December 2023 in Functions library

Summary

The functions contained within this package are all designed to help you in dealing with names data; specifically when a full name is contained within a single field. The functions, detailed below, help with resequencing names when commas are present (e.g. “Danny Roden” vs “Roden, Danny”) and then with parsing out each component into separate fields.

See below for a preview of the output from each function:


Sequence Full Name

This function helps address a common challenge seen when working on ‘full name’ fields, concerning inconsistencies in the presentation of that name. The function essentially checks if a comma is present, and if it is it then reorders the string so that the piece after the comma is displayed first. This ultimately results in “Smith, Mr John” being amended to “Mr John Smith”.

Note that this function is designed to work with data that contains up to 1x comma. If more than one comma is present then you may want to consider amending the function definition.

See below for the function definition:


Parse Title

This function takes the standardized form of the ‘full name’, from the above function, and then checks if the first word (i.e. before a ‘space’ character) matches one of the values in the ‘contains’ block. This function should be edited to ensure your list of valid titles are included (i.e. Monsieur, Mademoiselle, Lieutenant, HRH, Queen etc.)

Naturally if your list of valid titles is more than you’d like to manually add to the  ‘contains’ function block then you can amend this function to reference a dataset instead (using the ‘contains match’ function).

See below for the function definition:


Parse First Name

As the name suggests this function simply parses out (extracts) the first name from the full name. The function is logically defined to sequence the name (as above), remove the title and then keep the first word found (i.e. before a ‘space’ character).


See below for the function definition:


Parse Middle Name(s)

Again, this function looks at the sequenced name and strips away the title but also removes the first and last names leaving whatever other name(s) are present.


See below for the function definition:


Parse Last Name

Similar to the ‘parse first names’ check this function looks at the standard form of the full name, but then simply extracts the last word (space separated).


See below for the function definition:


Notes

Given that these functions interrelate to one another (for reference the relation is linear i.e. Sequence Full Name > Parse Title > Parse Forename > Parse Surname > Parse Middle Name), it’s recommended that all functions are added when you load the .dmx file into your environment.


Compatibility

These functions are compatible with all instances of Data Studio from v2.1.11 onwards.