Change Case in report field EmployeeName

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • KrazyKasper
    New Member
    • Mar 2008
    • 11

    Change Case in report field EmployeeName

    I need to change the EmployeeName field in my report (based on a query) to Proper case and change it from LAST, FIRST or LAST, MI, FIRST (Results should look like:John Q Smith).

    The name styles in the source table vary as some are LAST, FIRST, MI; others are LAST, FIRST. Also, some are all caps and others are not. I do not have authority to change the field in the table (ODBC link).

    Seems like it should be an easy fix but I haven't been able to figure it out. I can move the first name in front of the last name using TRIM but that's as far as I've gotten. Can anyone provide me some code that will get me started?

    Thanks,

    Krazy (Bill) Kasper
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    Originally posted by KrazyKasper
    I need to change the EmployeeName field in my report (based on a query) to Proper case and change it from LAST, FIRST or LAST, MI, FIRST (Results should look like:John Q Smith)...

    Seems like it should be an easy fix but I haven't been able to figure it out. I can move the first name in front of the last name using TRIM but that's as far as I've gotten. Can anyone provide me some code that will get me started?
    First off, I'm fascinated that you've managed to move the first name in front of the last name, using the Trim() function! Trim() removes leading and trailing spaces from a string! How could this possibly allow you to swap first and last names from a field?

    Secondly, you stated 3 months ago that you had solved this problem. What happened? At that time you were asked by NeoPa to post your code, which is normal forum etiquette when finding a solution off-site, but you apprently ignored this request. Perhaps you could post that code for us now, as a starting point.

    And FYI, this will not be an "easy fix!" Parsing names or addresses never are. You haven't begun to think about other things like honorifics at the end of the names (MD, Esq, Jr, IV) which will mess up figuring whether the name is Last MI First or Last First Honorific. These things will also defy formatting in Proper Case. So will hyphenated last names, Irish names (O'Brien) Scottish names (MacTavish) and the list goes on and on.

    Linq ;0)>

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32633

      #3
      Bill, finding the solution is fairly straightforward after the question is clearly defined. You haven't really specified what logic you wish to follow, which will cover what may and may not be assumed of the original data.

      Without this there really isn't a question, so answers will be tricky.

      Give it some thought, decide what you think needs doing, then try to put that down as clearly and logically as you can.

      We'll then see what we can do to help you.

      PS. Linq's post hopefully makes it clear why the logic in the request is so critically important, and as he says, this is not child's play.

      Comment

      Working...