dfiller Posted May 15, 2005 Posted May 15, 2005 Two questions. I'm not very good with FileMaker calculations... If I'm givin a tab delimited file containing a field that has someones name as - Doe, John - How do I use a calculation to take that field and and reorder the users names to John, Doe? Also, how would I go about taking that field, and seperating both the last and first names into their own two fields? Not sure what functions to use or how to go about this. Thanks in advance. ~Daniel
BobWeaver Posted May 16, 2005 Posted May 16, 2005 As long as the field always has the comma in it, it's easy: LastName = Left(InputField;Position(InputField;",";1;1)-1) FirstName = Middle(InputField; Position(InputField;",";1;1)+1;9999) So: FullName = FirstName & " " & LastName
Vaughan Posted May 16, 2005 Posted May 16, 2005 I'd approach this job by creating a small FMP database to act as an import processing file: the tab-delimited data gets imported into the FMP database and get turned into records and fields. Re-ordering the rows then becomes a matter of sorting the records. Splitting names is always a problem, because not all entries follow the "firstname lastname" format where the first and last names are one word each. How would you split "Mary Anne Smith" and "Vince De Saul"? If the name field has only two words then it's easy. But if there are more than two words human intevention will probably be necessary. We can still make a guess and say that the last word is the surname: all the rest is the first name. LastName = RightWords( namefield ; 1 ) FirstName = LeftWords( namefield ; WordCount( namefield ) - 1 ) I'd make a calc field that counted all the words in the name field, then find all those records with more than 2 words and process them by hand.
dfiller Posted May 16, 2005 Author Posted May 16, 2005 Thanks for your advice, will your functions work if the field involves a comma? I'll be sure to try this out tomorrow.
dfiller Posted May 16, 2005 Author Posted May 16, 2005 Thanks for all your help. That worked perfectly.
Recommended Posts
This topic is 7199 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now