By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,197 Members | 1,210 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,197 IT Pros & Developers. It's quick & easy.

Change Case in report field EmployeeName

P: 11
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
Sep 11 '08 #1
Share this Question
Share on Google+
2 Replies


missinglinq
Expert 2.5K+
P: 3,532
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)>
Sep 11 '08 #2

NeoPa
Expert Mod 15k+
P: 31,494
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.
Sep 11 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.