Joined: 08 Jan 2008
Location: United States
Online Status: Offline
Posts: 2
Topic: convert to initial caps Posted: 08 Jan 2008 at 12:54pm
I know there is a function to conver to initcaps using proper function. But when I tried with names like JOHN DOE III or JOHN D MCINTYRE, they will print out as John Doe Iii and John D Mcintyre where as it should actually be John Doe III and John D McIntyre.
Is there a way to convert these type of name with any other function in Crystal Reports. Thanks and appreciate for your help.
Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Posted: 09 Jan 2008 at 4:52am
Unfortunately, I don't think so. These are classic issues with case conversion functions. I know that I've seen a number of applications "fix" it by simply using UPPER instead of PROPER. I'm sure you've received that junk mail, too. But, trying to write an algorithm that accurately registers the difference between MacHall and Machine is rough.
Out of curiosity, is your database storing this as one string, or does it have the names and suffixes separated out into fields? If your suffix is a separate field, that, at least, may be easy to deal with.
IF {Suffix}[1] = "I" THEN Upper({Suffix}) ELSE Proper({Suffix})
Since I doubt you'll have too many people above the fifth generation (where the suffix would start with "V"), this allows the II and III to be upper, while the Jr., Sr., and Esq. will be proper. Of course, this still runs into a problem with degrees, like PhD, MSW, or MDiv. Depending on the values in your database, maybe you'd need to test for those.
Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Posted: 09 Jan 2008 at 10:24am
If this was truly mission critical, then I would build a database app which has a "rule engine" which lists the unique cases of possible prefixes which need to be customized. This list would be built by reviewing your data. Then loop through the records updating the names to their proper case. Unfortunately, this would be totally outside of the CR realm and would require writing a stored procedure or custom app which you might run once a month to "clean" the data. You could also write this rule engine in CR as a function (similar to what Lugh mentioned, but I would use an array that had all possible cases in it), but I doubt if it is important enough to go through that much trouble.
Edited by BrianBischof - 09 Jan 2008 at 10:25am
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
Joined: 08 Jan 2008
Location: United States
Online Status: Offline
Posts: 2
Posted: 09 Jan 2008 at 10:49am
Thanks for your input. Unfortunately, the database changes cannot be made as it is in read only mode. There is no suffix and the data is coming as a string. Probably, I have to loop through and identify the records and then make the necessary steps to convert them. Thanks again for all your help.
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