Select to view content in your preferred language

How to Create an Attribute Rule to Auto-Populate POLEID and BLOCK Fields Based on Maximum Value and Location

146
6
Thursday
YumkhaibamKabirAhmad
Emerging Contributor

Hi everyone,

I'm working with a point feature class in a file geodatabase. I want to implement an attribute rule that triggers when a new point is added, with the following requirements:

1. Auto-populate the BLOCK field based on the location of the new pole. I have a polygon layer (BlockBoundary) that contains block boundaries with a BLOCK field.

2. Auto-generate a unique POLEID by identifying the highest existing POLEID value within the same block and incrementing it by 1 for the new feature.

Ideally, the POLEID should follow a padded text format (e.g., "0001", "0002", etc.), and should concatenate the block number with the sequence (e.g., "03-0001"). ( BLOCK and POLEID are in text format

Has anyone implemented a similar rule using Arcade in attribute rules? I'm looking for guidance or a sample script that handles:

Filtering existing features by blocking and calculating the max POLETAGID within that block

Returning a properly formatted new ID

Thanks in advance for your help,

Best regards,

Kabir Ahmad

0 Kudos
6 Replies
MikeMillerGIS
Esri Frequent Contributor

You can set up #1 using a templated AR - https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/template-attribute-rules.ht...

 

For number #2, I would suggest using a database sequence(also in the templated rule), and not rely on querying for a pole, that could lead to a racing condition and duplicate ids.

YumkhaibamKabirAhmad
Emerging Contributor

Thank you the suggestion @ Mike, but template option is not available in my ArcPRO(3.5).

0 Kudos
MikeMillerGIS
Esri Frequent Contributor

It should be, they where first included in 3.4.

Try here - 

MikeMillerGIS_0-1754065022365.png

 

or here

MikeMillerGIS_1-1754065056360.png

 

 

YumkhaibamKabirAhmad
Emerging Contributor

The Templates option are not in 3.5 pro version, anyway thank you very much Mike, Im able to solve the problem. Thanks for your guidance.

0 Kudos
RhettZufelt
MVP Notable Contributor

I have att rule that is very similar to that here

I don't have text padding in that code, but it is an modified version of the code here that does pad the return result.

Should get you on the right track.  At least one way to do it anyway.

R_

YumkhaibamKabirAhmad
Emerging Contributor

Thank you Rhett, I already solved the problem but still i will try your arcade expression. Thanks

0 Kudos