Avatar of Danny Reader
Danny Reader
Flag for United States of America asked on

How to count array size when using split function?

I have a field (FullNameField) with various name formats:

Mr. John Smith
Mrs. Sally E. Jones
Rick Stevens
Pat Allen Williams

I can use the following formula to separate and identify the various parts of the name:

stringVar array x;
x := Split({FullnameField});
x[1]; //output first array element

I want to create new fields for Title, First Name, Middle Name, Last Name.  Is there a way to count the total number of array elements so it can be determined which field it should go in?
Crystal Reports

Avatar of undefined
Last Comment
Danny Reader

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Mike McCracken

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Danny Reader

ASKER
Finding the last element in the array won't help me.

If I can find out how many total elements are in the array along with a check to see if the first element is Mr. Mrs. or Ms. then I can determine if my Title formula should be the first array element or blank.  Then my First Name formula would display the first array element only if it is not Mr. Mrs. or Ms. etc.

At least that's the plan, I just need to get the array size for each name and I'll see if this could work.  Any suggestions on another approach would be greatly appreciated.  Thanks!
GJParker

mlmcc has already given you the way to find out how many elements are in an array

UBound(x) or Count(x) both return the number of elements in an array
Danny Reader

ASKER
Thansk mlmcc, I should have read your suggestion more closely...the answer was there.  I initially tried x[UBound(x)] to get the last name.

UBound(x) is indeed the solution.  Thanks again!
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck