Split and Rearrange Text With Arcade?

8762
4
Jump to solution
05-01-2019 09:00 AM
deleted-user-1_r2dgYuILKY
Occasional Contributor III

I have fields with names in the format last, first, middle initial. I would like to display them as first, ME, last. Is this possible in Arcade using the Split function?

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

How is your data formatted? If it's in a field as "Smith, John A" then you can use

var arrName = split($feature.name, ",")
return arrName[1] + " " + arrName[0]‍‍‍‍‍‍‍‍

This returns "John A Smith"

View solution in original post

4 Replies
KenBuja
MVP Esteemed Contributor

How is your data formatted? If it's in a field as "Smith, John A" then you can use

var arrName = split($feature.name, ",")
return arrName[1] + " " + arrName[0]‍‍‍‍‍‍‍‍

This returns "John A Smith"

deleted-user-1_r2dgYuILKY
Occasional Contributor III

There's no comma just spaces, but this works. Thanks!

0 Kudos
KenBuja
MVP Esteemed Contributor

Glad to help. Don't forget to click the "Mark Correct" button.

0 Kudos
SarahHartholt
Occasional Contributor III

I have created a Cell_ID field to store grid index values in a road feature class. For example, if Main St. falls within grid cells B1, B2, C2 & C3, my Cell_ID field is populated with "C3,B2,C2,B1". Is there any way for me to reorder the values alphabetically and then numerically as B1, B2, C2 & C3? 

SarahHartholt_1-1615233645324.png

 

Solved my problem below:

 

var arrName = split($feature.Cell_ID, ",")
return concatenate(sort(arrName))