Swap last and first at the comma

Build your list of AccuZIP6 commands by requesting commands and sharing commands with other users

Moderators: Steve, Terry, Donna, Dave, Eric, MartyH, Kristen, Chrissy, Geoff, Vince

Post Reply
User avatar
Posts: 1912
Joined: Tue Sep 19, 2006 3:29 pm

Swap last and first at the comma

Post by Eric » Fri Mar 14, 2014 8:45 am

*Example: Cowher, Bill & Kaye changes to Kaye & Bill Cowher
*Example: Roethlisberger, Ben changes to Ben Roethlisberger
*Example: Gordon III, Melvin changes to Melvin Gordon III

This command requires the name appear in the field named First

Code: Select all

Replace first with ALLT(ltrim(substr(first,at(",",alltrim(first))+1)))+" "+left(first,at(",",alltrim(first))-1) for occur(",",alltrim(first))>0
This command moves anything before the comma to the end of the field, after what originally appears after the comma. This example uses a comma and the field named First. With some field name changing, you can use this command on any field. You can change the comma to a hyphen or pipe if that's the character that you want to trigger the swap. Any field, any character.
Chat with an AccuZIP6 technician weekdays from 7-4 PST with AccuZIP6 Live Online Support

Post Reply