Append record to table in Arcade with calculation attribute rule

513
2
Jump to solution
09-05-2022 03:22 AM
Bart-JanSchoenmakers
New Contributor III

Hello,

Does anyone knows if it is possible with a Calculation Attribute Rule to append a record to another table?

My objective is whenever a point is edited to write a record to a table.

I’ve been looking around the forum and the help and this doesn’t seem possible in Arcade, however it might be that I missed something.

 

Thanks all,

Bart-Jan Schoenmakers

Statistics Portugal

0 Kudos
2 Solutions

Accepted Solutions
JohannesLindner
MVP Frequent Contributor

This is absolutely possible.

Instead of specifying the field for the rule and returning a value, you leave the field empty and return a dictionary. This dictionary has to have a defined structure, which you can find here:

https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/attribute-rule-dictionary-k...

 

A simple example:

 

// Calculation Attribute Rule
// field: empty
// triggers: insert

return {
    edit: [
        {className: "OtherTable",
            adds: [
                {attributes: {TextField: "Value", IntegerField: 5}}
            ]
        }
    ]
}

 

 

EDIT: And you can do lots of other things, too. A few examples are listed in this blog post:

Advanced Attribute Rules - Editing features on another class with attribute rules (esri.com)

 


Have a great day!
Johannes

View solution in original post

Bart-JanSchoenmakers
New Contributor III

Hi Johannes,

Thank you for this example and the link of the help.

I easily managed to get an example to work. I only knew the return dictionary for multiple fields, but dictionaries are so much more useful and powerful.  I thought I had to develop a trigger in Oracle.

Bart

View solution in original post

0 Kudos
2 Replies
JohannesLindner
MVP Frequent Contributor

This is absolutely possible.

Instead of specifying the field for the rule and returning a value, you leave the field empty and return a dictionary. This dictionary has to have a defined structure, which you can find here:

https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/attribute-rule-dictionary-k...

 

A simple example:

 

// Calculation Attribute Rule
// field: empty
// triggers: insert

return {
    edit: [
        {className: "OtherTable",
            adds: [
                {attributes: {TextField: "Value", IntegerField: 5}}
            ]
        }
    ]
}

 

 

EDIT: And you can do lots of other things, too. A few examples are listed in this blog post:

Advanced Attribute Rules - Editing features on another class with attribute rules (esri.com)

 


Have a great day!
Johannes
Bart-JanSchoenmakers
New Contributor III

Hi Johannes,

Thank you for this example and the link of the help.

I easily managed to get an example to work. I only knew the return dictionary for multiple fields, but dictionaries are so much more useful and powerful.  I thought I had to develop a trigger in Oracle.

Bart

0 Kudos