Lani Vriezema
asked on
Need to extract the first name
I need to extract the first name only.
Here is the current format from the system:
LastName;Firstname Middle Initial
Ex. Doe;Jane R
I am able to extract the first name with the middle initial. I just need the first name only.
I am using a two-part formula
Part 1: right({PRM_MASTER__EMPLOYE E.Employee _Name},len ({PRM_MAST ER__EMPLOY EE.Employe e_Name})-I nstrRev({P RM_MASTER_ _EMPLOYEE. Employee_N ame},";"))
Part 2: left({@Formula 1},len({@Formula 1})+1)
Here is the current format from the system:
LastName;Firstname Middle Initial
Ex. Doe;Jane R
I am able to extract the first name with the middle initial. I just need the first name only.
I am using a two-part formula
Part 1: right({PRM_MASTER__EMPLOYE
Part 2: left({@Formula 1},len({@Formula 1})+1)
ASKER
Bill,
The formula did not work in Crystal report.
Best Regards,
Mailan Vriezema
The formula did not work in Crystal report.
Best Regards,
Mailan Vriezema
You had marked this question as topic "R", is that not the case? Is it actually a Crystal Reports question? If so please adjust the topics to indicate this...
»bp
»bp
ASKER
Bill,
My apologies.
L
My apologies.
L
Doing it all at once, try this.
»bp
Mid({PRM_MASTER__EMPLOYEE.Employee_Name}, Instr({PRM_MASTER__EMPLOYEE.Employee_Name}, ";") + 1, Instr(Instr({PRM_MASTER__EMPLOYEE.Employee_Name}, ";"), {PRM_MASTER__EMPLOYEE.Employee_Name}, " ") - Instr({PRM_MASTER__EMPLOYEE.Employee_Name}, ";") - 1)
»bp
ASKER
I got an error message:
String length is less than 0 or not an integer.
String length is less than 0 or not an integer.
Could you have data that has no middle initial? For example:
Smith;Joe
»bp
Smith;Joe
»bp
ASKER
Some employee files do not have a middle initial.
You could try using Split for this instead of InStr etc.
Split(Split({PRM_MASTER__E MPLOYEE.Em ployee_Nam e}, ";")[1], " ")[1]
Split(Split({PRM_MASTER__E
ASKER
Norie,
It only extracted the last name and not the first name. I need to be able to extract the first name only.
It only extracted the last name and not the first name. I need to be able to extract the first name only.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Oops, got my indices mixed up.:)
Open in new window
»bp