Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recalculating an alpha field value based on special characters (Last Name)

Status
Not open for further replies.

ldalessio

Programmer
Apr 16, 2008
23
US
Good Morning -
I would like to recalculate a double last name field to return a new value based on special characters and spaces.
For example: Diaz-Garcia would return Diaz, Abel Smith would return Abel. Not sure how to go about this.
Thank you for all the help.
 
if '-' in {table.lastname}
then split({table.lastname},'-')[1]
else {table.lastname}
 
To get Abel from Abel Smith in your example, add space too in the formula suggested by Charliy,

[tt]if '-' in {table.lastname}
then split({table.lastname},'-')[1]
else if ' ' in {table.lastname}
then split({table.lastname},' ')[1]
else {table.lastname}[/tt]
 
Thank you everyone. As always, you guys are terrific!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top