cancel
Showing results for 
Search instead for 
Did you mean: 

Change display order of name data

Former Member
0 Kudos

We have most of the names in particular column are backwards, here you have last_name, First_name, and middle initial.

DOOLEN JOHN W. We prefer to display rather as John W. Doolen (First, mid, last)

Howeve, what to do with some which has the JR. IN that case, the JR is currently second place, sb 4rth place.

DOOLEN JR JOHN W

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member205840
Active Contributor
0 Kudos

Hi Paul,

Dell suggested formula is good, in case if you find it difficult try below :

Numbervar i:=ubound(split({@field},' '));

stringvar n:='';

if ubound(split({@field},' '))=4 Then

n:= split({@field})[i-1]+' '+split({@field})[i]+' '+split({@field})[i-2]+' '+split({@field})[i-3]

Else

n:=split({@field})[i-1]+' '+split({@field})[i]+' '+split({@field})[i-2];

Note : replace {@field} with your database field.

Thanks,

Sastry

DellSC
Active Contributor
0 Kudos

I might do something like this:

StringVar name := '';

NumberVar i

if not IsNull({field}) and {field} != "" then

  if split({field}, ' ')[2] in ['JR', 'II', 'III'] then

  (

     for i := 3 to ubound(split({field}, ' ') Do

     (

        name := name + split({field}, ' ')[i] + ' ';

     ) 

     name := name + split({field}, ' ')[1] + ' ' + split({field}, ' ')[2];

  )

  else

  (

     for i := 2 to ubound(split({field}, ' ') Do

     (

        name := name + split({field}, ' ')[i] + ' ';

     ) 

     name := name + split({field}, ' ')[1];

  )

)

name

This will produce the name in all caps, so you'll also have to change the string to mixed/title case to get the output you're looking for.

-Dell