Select to view content in your preferred language

How to have a number and string format in the same field show in the same popup using Arcade.

818
2
Jump to solution
08-28-2023 03:50 PM
Labels (2)
aduyvesteyn
New Contributor

Hello there I have seem to come into an issue regarding an arcade popup. Within the same field in an attribute table there is both a nine digit number that needs to be formatted like (000-000-000) and a string value that does not need to be formatted in that sequence. Is there any arcade expressions that I could use to help me solve this issue so the pop up does not appear like it does in figure 2.

aduyvesteyn_0-1693262845534.png

Figure 1. Attribute table example

aduyvesteyn_1-1693262995116.png

Figure 2. Pop up Formatting issues 

Thank you and I appreciate your feedback. 

 

0 Kudos
1 Solution

Accepted Solutions
JohannesLindner
MVP Frequent Contributor
var txt = $feature.TextField1
if(IsNaN(Number(txt))) { return txt }
var parts = [
  Left(txt, 3),
  Mid(txt, 3, 3),
  Right(txt, 3)
]
return Concatenate(parts, "-")

 

JohannesLindner_0-1693293991369.png

 

JohannesLindner_1-1693294034955.png

 


Have a great day!
Johannes

View solution in original post

2 Replies
JohannesLindner
MVP Frequent Contributor
var txt = $feature.TextField1
if(IsNaN(Number(txt))) { return txt }
var parts = [
  Left(txt, 3),
  Mid(txt, 3, 3),
  Right(txt, 3)
]
return Concatenate(parts, "-")

 

JohannesLindner_0-1693293991369.png

 

JohannesLindner_1-1693294034955.png

 


Have a great day!
Johannes
aduyvesteyn
New Contributor

Thank you so much!

 

0 Kudos