# READERS ASKS: Parse out the first letter of a last name with FileMaker

Please Note: If you are viewing this page in a news feeder, the images may get munged up a bit or other formatting of the posting may fail. For the best experience, please visit the journal directly by clicking (here)

I am trying to parse out the first letter of a last name in a field that has first/last name. I also want a period after the first letter of last name.

I have gotten the first name and the period figured out. But when I do my calculation it gives me the last instead of first) letter of the last name!

Any thought?

-------
DWAYNE RESPONDS
This shouldn’t be a problem when you create your calculation using the right and position functions. In your case, the “/” character is used to separate the first and last names. Once you know the position of the “/” character, you will want the next non-blank character afterwards.

Let([
data = "first/last";
separatorposition = Position ( data ; "/" ; 1 ; 1 );
rightofPos = Right ( data ; separatorposition -2 )];

rightofPos)

Since writing a nested function can get tricky, I’ve gotten into the habit of using the Let function to build the calculation. This can be handy because you can change the final calculated value to double check the progress along the way. Say you think that you are missing the exact location of the “/”. You can edit the calculation (normally in the Data Viewer) to see how that sub-calculation looks.

Let([
data = "first/last";
separatorposition = Position ( data ; "/" ; 1 ; 1 );
rightofPos = Right ( data ; separatorposition -2 )];

separatorposition)

Here are some links to other discussions of the Let function
The FileMaker Let And Filter Functions For The Uninitiated

© 2012 - Dwayne Wright - dwaynewright.com

The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.