PDA

View Full Version : split 1 field into 2



helpless
October 16th, 2002, 03:00 PM
I have a mbr name field, always last name, firstname.

is there any way to split at the comma to create 2 seperate fields (last name, first name)?

Mike Urbonas
October 16th, 2002, 06:34 PM
Originally posted by bls:
I have a mbr name field, always last name, firstname.

is there any way to split at the comma to create 2 seperate fields (last name, first name)?Yes. In your model, just capture the entire name as one field (call it "Name"). Then in the Table view, take a look at the LSPLIT function.

The Calculated Field formula:

LSPLIT(Name,2,",",1)

will get the last name (Formula is telling Monarch "Split the Name field into 2 strings, whereever the comma appears. Then display the first of the two strings.")

and this formula:

LSPLIT(Name,2,",",2)

will get the first name. If there is a space after the comma and before the first name, this will get rid of that space:

LTRIM(LSPLIT(Name,2,",",2)

Regards
Mike