Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: extract from a data field Post Reply Post New Topic
Author Message
Mary05
Newbie
Newbie
Avatar

Joined: 06 Nov 2007
Location: Canada
Online Status: Offline
Posts: 1
Quote Mary05 Replybullet Topic: extract from a data field
    Posted: 06 Nov 2007 at 12:08pm
Without using the word extract, how can I seperate a last name first name.
I would like to extract only the last name from a field that contains last name, first name - a comma seperates the last name from the first name.
When I used Extract and put the report on the menu, the report did not work because of the useage of Extract.
Thank you for your help.
IP IP Logged
wattsjr
Groupie
Groupie
Avatar

Joined: 25 Jun 2007
Location: United States
Online Status: Offline
Posts: 51
Quote wattsjr Replybullet Posted: 06 Nov 2007 at 12:59pm
Hi Mary05,
 
Try creating a formula called somerthing like LastNameExtract.
 
In the formula use the following:
 
Left ({NameField},InStr ({NameField}, "," ) -1 )
 
The "InStr" function finds the "," in your {NameField} and returns the position of it in the string.
 
The "Left" function starts at the left of your string and stops at a specified position.
 
So, in the case of "Doe, Jane", the "InStr finds the "," in position 4 and the "Left" function starts in position 1 and stops in position 4,  - 1 to exclude the comma, which should be "Doe".
 
I hope that this helps.
 
Regards, 
-jrw
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.