Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

troublesome loop

Status
Not open for further replies.

Gramm

Instructor
May 16, 2003
92
US
I am trying to print only the first character of the first name, middle name and last name of a name field.

Larry Wayne Jones would be printed as LWJ

I can't get the looping construct to behave correctly. The result for the first character is correct but after I continue the logic the result returns true. Any assistance would be appreciated.
 
if all of your names are going to have a middle initial use this

local stringvar initials;
local stringvar array fullname := split({namefield});
initials := left(fullname[1],1) & left(fullname[2],1) & left(fullname[3],1)

if there are going to be some without middle initials let me know and I can fix the code.

_____________________________________
Crystal Reports XI Developer Version
Intersystems Cache 5.X ODBC connection

 
Gramm,

Try:

stringvar array txt;
txt := split({table.name}," ");
if ubound(txt) = 3 then
left(txt[1],1) & left(txt[2],1) & left(txt[3],1)
else if ubound(txt) = 2 then
left(txt[1],1) & left(txt[2],1)
else
{table.name}

Andy

Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top