Results 1 to 6 of 6

Thread: [RESOLVED] Capitalize Suffix(Names) in Crystal

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2007
    Location
    Iowa
    Posts
    298

    Resolved [RESOLVED] Capitalize Suffix(Names) in Crystal

    How should I go about capitalizing Suffixes for names in Crystal.

    John Smith IV not John Smith Iv

    Right now the report is set up so it puts things in proper case, which obviously doesn't work in this case.

    However, I'll also need to be able to handle:

    John Smith Jr not John Smith JR

    Can someone point me in the right direction? Please?

    It would be a great birthday present for me

    Thanks!!!!
    Tuber

    "I don't know the rules"

  2. #2
    Frenzied Member
    Join Date
    Aug 2006
    Location
    India, Punjab, Bhatinda
    Posts
    1,689

    Re: Capitalize Suffix(Names) in Crystal

    For a starter how do I know which words are to be Caps and which to be propercase. (Iam talking only of the lastname)

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2007
    Location
    Iowa
    Posts
    298

    Re: Capitalize Suffix(Names) in Crystal

    Okay, well, I guess I'll handle it with a long CASE statement.

    However I'm not sure how to do this in Crystal. I know how to do the replace, just not how to get the Suffix.

    I need to do Right I know this but then I need to grab all the character to the indexof(" ") a space delimiter. Which I don't know how to do.

    So I'll need to set up a formula.

    I need something likes this but I don't know how to use the right with an index of. I think I need to use the character key instead of " ", but I don't think Crystal has an IndexOf correct?

    Code:
    
    
    Select  Right(Trim({Table.LastName}), Indexof(" "))
    Case "IV"
    : Replace({Table.LastName}, " iv", " IV")
    Case "JR"
    : Replace({Table.LastName}, " jr", " Jr")
    Tuber

    "I don't know the rules"

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Capitalize Suffix(Names) in Crystal

    personally, it should have been stored in the DATABASE correctly in the first place. Report rendering isn't the place to be correcting bad data. Reports should display. At best, a few minor calculations, but there should be no data manipulation at all. If, how ever correcting the data isn't a solution, then maybe a correction to the driving query that feeds the report.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2007
    Location
    Iowa
    Posts
    298

    Re: Capitalize Suffix(Names) in Crystal

    I completely agree with you on that. If only this was a database that we maintained it would be that way.

    However, this is the solution I came up with. I'm still testing it but it seems to work.

    Found on http://www.vbforums.com/showthread.p...ighlight=Index from brucevde.

    Thanks everyone for the help!

    Code:
    stringVar array values;
    numberVar index := 0 ;
    
    values := split({Agent_Hierarchy.AgentLast});
    
    for index := 1 to ubound(values) do
    (
    
    Select values[index]
    Case "jr"
    : values[index] := uppercase(left(values[index],1)) + lowercase(mid(values[index],2))
    
    
    
    Case "iii" 
      : values[index] := uppercase(values[index])
    
    
    Default  
      : values[index] := uppercase(left(values[index],1)) + lowercase(mid(values[index],2));
    
    );
    
    
    join(values)
    Tuber

    "I don't know the rules"

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2007
    Location
    Iowa
    Posts
    298

    Re: [RESOLVED] Capitalize Suffix(Names) in Crystal

    Finished Code in case someone, somewhere needs to do this.

    {@Full Name} = just another Formula that combines the First and Last Name. (First_Name + " " + Last_Name) Could have easily put it all in one.


    Code:
    stringVar array values;
    numberVar index := 0 ;
    
    values := split({@Full Name});
    
    for index := 1 to ubound(values) do
    (
    
    Select values[index]
    Case "jr"
    : values[index] := ProperCase(values[index]) + "."
    
    Case "sr"
    : values[index] := ProperCase(values[index]) + "."
    
    Case "ii"
      : values[index] := uppercase(values[index])
    
    Case "iii" 
      : values[index] := uppercase(values[index])
    
    Case "iv" 
      : values[index] := uppercase(values[index])
    
    Case "v" 
      : values[index] := uppercase(values[index])
    
    Case "vi" 
      : values[index] := uppercase(values[index])
    
    Case "vii" 
      : values[index] := uppercase(values[index])
    
    Case "viii" 
      : values[index] := uppercase(values[index])
    
    Case "ix" 
      : values[index] := uppercase(values[index])
    
    Case "x" 
      : values[index] := uppercase(values[index])
    
    Case "xi" 
      : values[index] := uppercase(values[index])
    
    Case "xii" 
      : values[index] := uppercase(values[index])
    
    Case "xiii" 
      : values[index] := uppercase(values[index])
    
    Case "m.d." 
      : values[index] := uppercase(values[index])
    
    Default  
      : values[index] := Propercase(values[index])
    
    );
    
    
    join(values)
    Tuber

    "I don't know the rules"

Posting Permissions

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



Click Here to Expand Forum to Full Width