Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2002
    Location
    Hartford, CT
    Posts
    106

    Unanswered: 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

  2. #2
    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;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •