Leading Zeros for Facility ID in Feature Class using Attribute Rules and Arcade

208
4
Jump to solution
03-03-2021 01:54 PM
Labels (2)
AnnaPeters
New Contributor II

Hello,

I am trying to generate Facility IDs for my Water Meter feature class in ArcGIS Pro using Attribute Rules. This is the code I have so far, but I need to figure out how to add leading zeros, or decimal places to the ID. What I come up with is "wMET3" and I would like "wMET003".  Any insight would be greatly appreciated. 

AnnaPeters_0-1614808376018.png

if(isempty($feature.FACILITYID)) return concatenate("wMET" + nextsequencevalue("wMeterSeq"));

 

 

 

0 Kudos
1 Solution

Accepted Solutions
LanceCole
MVP Regular Contributor

I have not worked with this in Pro Attribute Rules but the Concatenate function in Arcade is Concatenate( values, separator?, format? ).  Try using the following in your return:

 

Concatenate(['wMET', nextsequencevalue("wMeterSeq")], '', '000')

 

 

 

 

View solution in original post

4 Replies
jcarlson
Regular Contributor II

Put your sequence value into the Text function. In the format parameter, a '0' is a mandatory digit, which will appear as a leading zero if the sequence is not that high yet.

 

var seq_num = 3

return 'Meter' + Text(seq_num, '0000')

 

Returns:

'Meter0003'

 

- Josh Carlson
Kendall County GIS
LanceCole
MVP Regular Contributor

I have not worked with this in Pro Attribute Rules but the Concatenate function in Arcade is Concatenate( values, separator?, format? ).  Try using the following in your return:

 

Concatenate(['wMET', nextsequencevalue("wMeterSeq")], '', '000')

 

 

 

 

View solution in original post

jcarlson
Regular Contributor II

I'm so used to concatenating w/ a "+" I completely forgot about that. Nice!

- Josh Carlson
Kendall County GIS
AnnaPeters
New Contributor II

Both of these processes worked. Thanks so much!

0 Kudos