Select to view content in your preferred language

How do I update a field based on another field's response?

260
4
12-04-2024 07:22 AM
Labels (3)
Savannah2019
Regular Contributor

Please help. I don't even know where to start. I see other similar questions talk about arcade, but where are they putting that in? I don't want an expression, I want a full override of the field. Are they making a notebook?

I'm working with one feature class with a lot of redundant fields, but I want to make the person inputting the data's job a bit easier. So if field A isn't blank, I want field B to update to "Yes". Depending on the answer to field A, field C would get answered in one of two ways. And so on. This would be updating pre-existing records that already have a value, there is no data creation.

I have a field map for field staff and and a web app builder for office staff to update the occasional point.

I have access to Make/Integromat in addition to the esri platform, but I do NOT understand how to make an api call to overwrite a feature's value. I only have a limited understanding of coding (lite python and arcade expressions), so I really need this dumbed down for me. Please help!

 

 

 

 

0 Kudos
4 Replies
MobiusSnake
MVP Regular Contributor

I'm working with one feature class with a lot of redundant fields, but I want to make the person inputting the data's job a bit easier. So if field A isn't blank, I want field B to update to "Yes". Depending on the answer to field A, field C would get answered in one of two ways. And so on. This would be updating pre-existing records that already have a value, there is no data creation.


To clarify, do you want this behaviour to occur while a user is editing their records' attributes - for example, after they set field A, field C's value/behaviour changes - or you want a process to come in after the user has completed their work and calculate field values based on what they entered?

If it's the first case, it's complicated because there's no way to enforce that kind of behaviour at the data store level in ArcGIS Online.  You need to ensure your users are using clients that support that kind of thing, either Arcade-enabled forms through something like Field Maps or the Web Editor, or something like Survey123 that supports conditional logic in its own way.  Make/Integromat/etc. can apply edits but it can't do things like change field visibility as Field Maps/S123/etc. can do, or limit selections to subsets the way Survey123 can do.

If it's the second case, I find scheduled notebooks are the best way to accomplish this.  I'll often include a "processed" field with a flag of 0 or 1, if the notebook has processed the record to apply the calculations it flips the value to 1.  This lets me hide records pending processing to users, as well as avoid processing records more than once.  An exception to this would be if your data needs to be updated in near-real time, in that case Make/Integromat/etc. are your best bet since notebooks can be scheduled to run at a maximum of 15 minute intervals.

0 Kudos
KristalWalsh
Frequent Contributor

Hi Savannah, I'm probably the last person to advise on code but I have done this with help in the ArcGIS online platform in the forms. I have a relational database and wanted fields to populate from other feature classes or tables. I used Arcade in the form for both feature:feature and feature:table relates. Here are a few resources I have used. 

Using Calculated Expressions with Related Records in ArcGIS Field Maps 

What’s new with Arcade: Taking a stroll through FeatureSets (Part 1)  and there's a part II also (this is the older version but you'll get it)

I've attached a screen shot of where you configure the form from ArcGIS online. Just click on the layer in the web map and then the form icon from the right-hand ribbon. You may know all this but didn't want to assume anything. Good luck! Kristal

Kristal Walsh, Florida Fish and Wildlife
Office of Conservation Planning
0 Kudos
KristalWalsh
Frequent Contributor

By the way, I'm using my configured expressions in Experience Builder and then also in Field Maps. So far, everything seems to be working in the EB app. 

Kristal Walsh, Florida Fish and Wildlife
Office of Conservation Planning
0 Kudos
EmilyGeo
Esri Contributor

Hi @Savannah2019

You can use Arcade to write expressions that automatically calculate the value in a field(s). You can configure forms so the fields are calculated when the date is collected. Here are some resources to get you started:

  1. Check out the Calculated Expressions section of this blog article that walks you through where to input Arcade expressions: https://www.esri.com/arcgis-blog/products/arcgis-online/mapping/smart-forms-arent-just-for-field-map...
  2. You may want to get familiar with If Else statements for use in your own expressions since you want to calculate values based on answers in other fields. There are some good examples in this technical support article: https://support.esri.com/en-us/knowledge-base/how-to-utilize-multiple-arcade-if-statements-in-arcgis...

 

0 Kudos