We help IT Professionals succeed at work.

Crystal - Name display

kelsanit
kelsanit asked
on
have field that displays name as {lastname}, {firstname} {initial}

how can I get to display as firstname lastname

example
Major, Jerome W.

Result:  
Jerome Major
Comment
Watch Question

Mike McCrackenSenior Consultant
Most Valuable Expert 2011
Top Expert 2013

Commented:
Are they 3  separate database fields?

If so
Create a textbox in the report
Drag the first name field to the box
Type a space
Drag the last name field to the box

If you want you can create a formula
{firstname} + ' ' + {lastname}

mlmcc

Author

Commented:
no it is all in one field called name
Mike McCrackenSenior Consultant
Most Valuable Expert 2011
Top Expert 2013

Commented:
Does it always have that format?

If so try this formula

Local StringVar Array strNames;
Local StringVar LastName;
Local StringVar FirstName;

Names := Split({Name}, ',');

LastName := strNames[1];
FirstName := Split(Trim(strNames[2], ' ');

FIrstName + ' ' + LastName

Open in new window


mlmcc

Author

Commented:
yes, always in same format.

Tried formula but getting error saying "remaining text does not appear part of the formula after the "local stringvar Firstname;

Local StringVar Array strNames;
Local StringVar LastName;
Local StringVar FirstName;
Names:= Split({EmployeeHours.Name}, ',');
LastName:= strNames[1];
FirstName:= Split(Trim(strNames[2], ' ');
FIrstName + '
Mike McCrackenSenior Consultant
Most Valuable Expert 2011
Top Expert 2013

Commented:
Assuming you copied it I see 2 issues
Names on that line should be strNames
The assignment to FirstName was missing a ) at the end

Local StringVar Array strNames;
 Local StringVar LastName;
 Local StringVar FirstName;
 strNames:= Split({EmployeeHours.Name}, ',');
 LastName:= strNames[1];
 FirstName:= Split(Trim(strNames[2], ' '));
 FIrstName + ' ' + LastName
 

Open in new window


mlmcc

Author

Commented:
now getting "to many arguments have been given to this function" for the FirstName:= Split(Trim(strNames[2], ' '));
Senior Consultant
Most Valuable Expert 2011
Top Expert 2013
Commented:
I put the ) in the wrong place

FirstName:= Split(Trim(strNames[2]), ' ');

mlmcc
I think that should that be

FirstName:= Split(Trim(strNames[2]), ' ') [ 1 ];


 Also, just to throw this out there, if the names could include something like ", Jr." after the last name (eg. "Major, Jr., Jerome W."), the formula won't handle those (you'd get "Jr. Major").  I don't know if there's a good way to handle that.

 James