Arcade Attribute Rule--Get selected feature ID and assign it to a newly created row

2669
3
Jump to solution
06-17-2021 12:05 PM
Labels (2)
YinghongLi1
Occasional Contributor

My case is like following:

1.  user selects a feature.

2.  user creates a new row in the feature's relate table

3.   An Arcade attribute rule in the relate table will get the selected feature's ID and assign the ID to the newly created row.

Not sure if this can be done since two $feature variables needed.  have not see a sample which updates a table.

Note:  database is Oracle/SDE.  Table is registered with SDE so it has OID.

Thanks...

 

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
JohannesLindner
MVP Frequent Contributor

What you describe isn't possible right now, because Arcade doesn't recognize selections.

It is absolutely possible to get other tables (take a look at the FeatureSetBy* functions) and to edit another table (take a look at this blog).

So you could get your feature class with FetaureSetBy* and then filter it. For that, you need a field that is in both tables. In your case, that is likely the ID, and you want to get that, so this way isn't possible.

If the table you're creating a new row in (step 2) is a feature class, maybe an intersect works for you ("If this new point intersects an existing polygon, take that polygon's ID").

If you have a feature class and a non-spatial table, and the only field linking those is ID, then you can't do this with Arcade.

What you could do:

  1. Create a relationship class between the fc and table
  2. Select a feature
  3. Open the Attribute Pane
    JohannesLindner_0-1623999789258.png
  4. Expand the feature to see its relationships
    JohannesLindner_1-1623999932416.png
  5. Right click on the relationship you created, "Add New To Relationship"
    JohannesLindner_2-1624000097875.png
  6. ArcGIS creates a new record in the related table, puts the feature's ID in the field specified by the relationship class, and opens the new row in the Attribute pane.

Have a great day!
Johannes

View solution in original post

3 Replies
JohannesLindner
MVP Frequent Contributor

What you describe isn't possible right now, because Arcade doesn't recognize selections.

It is absolutely possible to get other tables (take a look at the FeatureSetBy* functions) and to edit another table (take a look at this blog).

So you could get your feature class with FetaureSetBy* and then filter it. For that, you need a field that is in both tables. In your case, that is likely the ID, and you want to get that, so this way isn't possible.

If the table you're creating a new row in (step 2) is a feature class, maybe an intersect works for you ("If this new point intersects an existing polygon, take that polygon's ID").

If you have a feature class and a non-spatial table, and the only field linking those is ID, then you can't do this with Arcade.

What you could do:

  1. Create a relationship class between the fc and table
  2. Select a feature
  3. Open the Attribute Pane
    JohannesLindner_0-1623999789258.png
  4. Expand the feature to see its relationships
    JohannesLindner_1-1623999932416.png
  5. Right click on the relationship you created, "Add New To Relationship"
    JohannesLindner_2-1624000097875.png
  6. ArcGIS creates a new record in the related table, puts the feature's ID in the field specified by the relationship class, and opens the new row in the Attribute pane.

Have a great day!
Johannes
YinghongLi1
Occasional Contributor

Thanks!  Too bad that i can't do the attribute rule on this.  However your solution worth to explore.

 

0 Kudos
YinghongLi1
Occasional Contributor

I tried this out and it works very well.  with editor tracking applied, all the values which need to be entered automatically are done.  thanks.  very smart!

0 Kudos