Introduction
Group templates are one way to create multiple features in one go by sketching just one feature. They have one primary template and one or more component templates. You can sketch and create a feature for the primary template, and the features for the component templates are created automatically, in accordance with the properties you set for that group template.
Normally you would then go to the attributes pane and set values to each new feature’s attributes. You can remove this manual step for any attributes that component templates have in common with the primary template using attribute rules. You can also use this in cases where you want to derive or calculate the component template’s attribute value from the attributes of the primary template.
This blog explains how you can achieve that.
Sample use case
Take the example of an Address Data Management project that you can access here.
There is a group template named Site Address Group Template in the example data that contains the Current Address template with the Point at beginning of line primary builder.
It also has two other builders:
- The Driveway Entrance template with the Point at every vertex, except start and end builder
- The Address Point template with the Point at end of line builder
Current Address features contain two fields named Site Address ID and Address Point ID.
Upon creation, you want the Driveway Entrance feature’s Site Address ID field to have the same value as that of the Site Address ID field of the Current Address feature. Similarly, you want the Address Point feature’s Address Point ID field value to be the same as the Address Point ID field value of the Current Address feature.
See the following example.
- Current Address: Site Address ID = SID-33 and Address Point ID = ADD-33
- Driveway Entrance: Site Address ID = SID-33
- Address Point: Address Point ID = ADD-33
You can achieve this using attribute rules.
All three layers must have Global IDs for the attribute rules to work.
Since this is a group template for the Current Address template, the feature for Current Address is created first, before the other two in the group template.
You can use this knowledge and write Arcade expressions for the Driveway Entrance and Address Point feature classes to update their attributes when their features are created.
For more details on how to access other features in an attribute rule, see the Advanced Attribute Rules – Editing features on another class with attribute rules blog post.
Arcade expressions
You can write an attribute rule for the Site Address ID field of the Driveway Entrance feature class, in which you obtain the latest created feature of Current Address and return that feature’s Site Address ID value from the Arcade expression.
Similarly, you can write an attribute rule for the Address Point ID field of the Address Point feature class, in which you obtain the latest created feature of Current Address and return that feature’s Address Point ID value from the Arcade expression.
Now when you create features using the group template, you can populate the attributes of the Current Address template. The attributes of the other two will be populated automatically upon creation.
Article Discussion: