Skip to Content
author's profile photo Former Member
Former Member

Change display order of name data

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Jul 20, 2016 at 03:00 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 21, 2016 at 06:48 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.