Attribute Rule for Ugly ID Format

307
2
09-29-2020 08:10 AM
JoeBorgione
MVP Emeritus

I have a series of id values that look like this:

PWOPS_pave00000001 through

PWOPS_pave00063681

I can create a geodatbase sequence easy enough to start at 63682 and increment by 1 but concatenating it with a potentially varying number of zeros has me scratching my head. In python one can use the zfill() method to pad zeros; is there way in Arcade to emulate that?  I didn't see anything in the text functions.

That should just about do it....
0 Kudos
2 Replies
MikeMillerGIS
Esri Frequent Contributor

Try this:

var numval = Text(64600)

var padCount = 10;

for (var i = Count(numval);i<padCount;i++){

numval = "0" + numval

}

return numval

JoeBorgione
MVP Emeritus

But in data functions  you can the Text()n function like this:

Text(63682, '0000000000')

// will return

0000063682

// or

Text(163682, '0000000000')

//which returns

0000163682
That should just about do it....
0 Kudos