Select to view content in your preferred language

calculate sequential letters in arcade

372
2
12-23-2024 11:04 AM
AmyKirkey
Emerging Contributor

Good Afternoon,

I am looking if it is possible in Field Maps expressions to auto calculate sequential letters similar to this post:

Solved: Field calculate sequential letters - Esri Community

We have an established naming convention that I would like to keep using.

Thanks

 

0 Kudos
2 Replies
RhettZufelt
MVP Notable Contributor

Have not tried this, but appears to be supported in the calculate field in Field Maps.

Not knowing the format of the sequential letters, not sure, but perhaps you could parse off the number(s) you need to sequence.  Split them so you can feed each to a ToCharCode() which will give you the character code for that letter.  Increment this by one and you get the next sequence letter, and so on. (would have to look at the start/end numbers for caps vs lower case, etc.).

Then you could append/concatenate the individual letters together with the FromCharCode() function.

var NumCode = ToCharCode('A')
//returns number: 65

var NumCode = FromCharCode(NumCode) + FromCharCode(NumCode + 1)
// returns text: "AB"
return NumCode

Like I said, have not tested, but seems like everything needed is in there, depending of course, on what the original data looks like and what output needs to be.

In case it helps,

R_

0 Kudos
AmyKirkey
Emerging Contributor

I apologize for not replying sooner, so the format is TYPE_UNIT_000_LetterCode, the number is linked to an ID of a related Feature layer and the Alpha code would be like a number count which would start at 'A' and count up as we made each new feature that had the same first parts of the code. In the past, I think the letter code had gotten up only 'K' at most. However, it might be easier to just transition to numeric to simplify repeatability

0 Kudos