We've had several clients working with memberships, who have a single name field with the full name of a person. And then they ask us to build a directory that is sorted by last name. This is a bit hard to do if there's a first name in front of it!
Names don't follow rules very well. Some have apostrophes in them, some have multiple words -- you can't just take the last word of a name and assume that's the last name, because often it just isn't.
I asked Perplexity AI for a list of names with these challenges, and it came up with a decent list:
- Jean-Luc D'Armand
- Isabella DeAngelo
- Maximilian Von Zeigeiser
- Aaliyah O'Connor
- Nia McAllister-Jones
- Pierre Leclercq
- Fiona Van der Meer
- Jaden O'Malley
- Sofia di Giovanni
- Liam Fitzpatrick-Smith
- Chloe D'Costa
- Hugo de la Cruz
- Maria Teresa Rodriguez-Sanchez
- Samuel St. Laurent
- Eliana Van der Linden
- Kieran O'Sullivan
- Amara N'Guessan
- Rachael LaFontaine
- Marcus de Souza
- Talia Quintero-Cruz
Faced with such a list, how do you get the correct last name?
This is a particularly good task for AIs. It's very difficult to code something to do this task correctly, but AIs handle it easily. And the AI module for Drupal can easily do this for you.
To make this work, you would have one field for the source -- the full name. And then for the first name and last name, you can use the AI Automators to extract the first name from the source field, and then the last name from the source field.
It's also easy to do similar tasks for other complex fields: addresses, invoices, ingredients.
Bonus tip: See Marcus's video on using a Custom Field to parse out ingredients in a recipe, on the Workflows of AI site.
Add new comment