Select to view content in your preferred language

Arcade: pre-populate new row of related table

903
2
05-21-2019 12:41 PM
JamesCrandall
MVP Frequent Contributor

I'm looking for a solution to pre-populate a column when editing a related table.  We have polygon features with a related table (hosted feature service) and simply want a way to insert new rows into that related table, which we can use the Edit Widget or Smart Editor widget in a WAB app just fine!

However, we'd like to prepopulate a common attribute from the selected feature when creating a new related record.

I've exhausted attempts to configure the widgets to accomplish this and now looking to see if an arcade expression can solve this for us.

Thanks!

2 Replies
JamesCrandall
MVP Frequent Contributor

For better explanation:

1. I have the Smart Editor widget configured on the Hosted Feature Service that has a single related table.  When accessing the widget and selecting a single polygon feature, it populates the widget and does not allow the feature attributes to be edited (that's what we want):

2. Now when adding a new record to the related table "StandAloneEditGUID - TxTable", we'd like to have the FuncionalLocation column pre-populated with the FUNC_LOC value of the selected feature (see above screen shot)

0 Kudos
JamesCrandall
MVP Frequent Contributor

Update: I can get both the Edit widget and Smart Editor widget to work as expected if the feature service was originally published with a relationship class that had a 1-M relate between the FUNC_LOC on the feature class and FunctionalLocation on the many table to auto-populate the FunctionalLocation value when creating a new record on the many table.

However, this same feature service is the source to a Survey123, which requires that 1-M relate to be between a GlobalID on the feature class and a GUID on the many table.  

I attempted to republish the feature service with two relationship classes with both 1-M relates specified above, but the Survey123 doesn't like that and will not publish.

0 Kudos