Select to view content in your preferred language

Help with automating a text box using Arcade.

661
2
Jump to solution
08-02-2023 03:34 PM
ColeNelson
New Contributor III

Hi I am trying to automate a text box in a layout that I am creating so that all I need to do is add the map from and the title is automatically formatted.  I've been working with arcade and have been using proper() function to do this.  However there are instances when I need every character in a group capitalized.  For example:

Screenshot 2023-08-02 162705.png

The title should read South Boundary Fire Protection District (F.P.D.) but when I use proper it generates (F.p.d.) instead. I have other areas with similar names so I was thinking I could capitalize the letter if it appears after a period or something along those lines.

Screenshot 2023-08-02 163009.png

This is the current code that I am using inside the expression builder, any suggestions or thoughts on how to this would be great.  I'm not quite sure how to go about doing this, so thank you for the help! 

1 Solution

Accepted Solutions
DuncanHornby
MVP Notable Contributor

If your text is always Abc (x.y.z) format, as in your abbreviations are always in brackets, then you could use this piece of Arcade:

var i = Find('(',$feature.name1);
var n = Count($feature.name1);
var x = (n - i);
var rTXT = Upper(Right($feature.name1, x));
var lTXT = Proper(Left($feature.name1, i));
return Concatenate([lTXT,rTXT]);

 

In my test data the text field is called name1, you would use NAME.

Code works by locating the first open bracket and then uses that location to pull out the right text to set UPPER and the left text to set PROPER.

View solution in original post

0 Kudos
2 Replies
DuncanHornby
MVP Notable Contributor

If your text is always Abc (x.y.z) format, as in your abbreviations are always in brackets, then you could use this piece of Arcade:

var i = Find('(',$feature.name1);
var n = Count($feature.name1);
var x = (n - i);
var rTXT = Upper(Right($feature.name1, x));
var lTXT = Proper(Left($feature.name1, i));
return Concatenate([lTXT,rTXT]);

 

In my test data the text field is called name1, you would use NAME.

Code works by locating the first open bracket and then uses that location to pull out the right text to set UPPER and the left text to set PROPER.

0 Kudos
ColeNelson
New Contributor III

That totally worked!!!  Thank you so much for the help!!!

0 Kudos