If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Crystal Reports > Need to re-arrange doctor's name

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-15-10, 12:37
mkasem mkasem is offline
Registered User
 
Join Date: Oct 2002
Location: Hartford, CT
Posts: 103
Need to re-arrange doctor's name

I am working on crystal reports v12.2..0.29. One of the input fields is the doctor's name and it is in this format (FIRSTNAME LASTNAME TITLE) but sometimes it is in this format (FIRSTNAME MI LASTNAME TITLE). My goal is to make it print in the (LASTNAEM TITEL FIRSTANAME MI). I was able to use the left function and get it to print correct if there is no middle initial. But it gets all ugly when there is a middle initial. I tried to use the split function -such as (Title = split({PROVIDER.PROVIDER_NAME}," ",5) - but it is returning a boolean value for the array entries. Please help.

Thanks
__________________
Mo
Reply With Quote
  #2 (permalink)  
Old 12-29-10, 12:09
splackey splackey is offline
Registered User
 
Join Date: Dec 2010
Posts: 2
Rearrange name

Use the InstrRev function to look for spaces. Use once for title, use again for last name. Concatenate the two and use the remainder for the firstname/mi portion. Will not matter what is left


e.g.

s_title := trim(mid(s_name,instrrev(s_name," "),99));
s_newname := trim(mid(s_name,1, instrrev(s_name," ")));
s_lname := trim(mid(s_newname,instrrev(s_newname," "),99));
s_fnameMI := trim(mid(s_newname,1, instrrev(s_newname," ")));

s_str := s_lname + " " + s_title + ", " + s_fnameMI;
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On