Hello.
I am wondering if i can automatically set the value in one column when the value in another column changes. More specifically, I have a 'status changed date' column that i'd like to populate with the current date whenever the value in the 'status' column changes. The value of the 'status changed date' could also be set manually if need be, but i'm imagining hiding 'status changed date' field on the form.
In the ideal scenario, the 'status changed date' would only be updated if the value of the 'status' column changed. For example, if the 'status' was already 'Complete' and the user inadvertently set the value to 'In Progress', recognized their mistake, and then changed back to 'Complete', the 'status changed date' would not be updated. That functionality is probably asking for more than what's possible, but thought it'd be nice to check just in case.
Thank you
Solved! Go to Solution.
In addition to what @Reinaldo_Cartagena mentioned, Field Maps recently added support for form calculations - these also use Arcade but work client-side in the mobile app. There is some overlap with attribute rules, but attribute rules are not supported client-side in the mobile app yet.
The form calculation is probably going to do what you need, the only downside is that the business logic is stored in the form so if you made changes to the data in another app that doesn't use the form, the logic wouldn't apply.
Here's an example to calculate when the in progress date when the status changes to in progress:
if ((DomainName($originalFeature,"status") != DomainName($feature,"status")) && (DomainName($feature,"status") == "In Progress")) {
return Now()
} else {
return $originalFeature.inprogressdate
}
Right now, Field Maps doesn't support calculating and also editing the same field. It's something we're planning to support though.
ArcGIS provides several options to do this, they are:
1) Attribute rules are complementary to existing rules used in the geodatabase, such as domains and subtypes. For example, domains can be assigned to an attribute field to aid in the data collection process by providing a pick list of valid values for editors. Additionally, an attribute rule can be used to restrict values for an attribute field that are not part of the domain when performing a field calculation. After rules are added to a dataset, they can be evaluated as edits take place or at a later time. See the following link:
2) Arcade is a portable, lightweight, and secure expression language used to create custom content in ArcGIS applications. Like other expression languages, it can perform mathematical calculations, manipulate text, and evaluate logical statements. It also supports multi-declaration expressions, variables, and control-flow statements. What makes Arcade particularly unique compared to other scripting and expression languages is the inclusion of geometry and feature data types.
Use Arcade expressions with Calculate Field. See the following link: https://enterprise.arcgis.com/en/portal/latest/use/geoanalytics-calulate-field-expression.htm
In addition to what @Reinaldo_Cartagena mentioned, Field Maps recently added support for form calculations - these also use Arcade but work client-side in the mobile app. There is some overlap with attribute rules, but attribute rules are not supported client-side in the mobile app yet.
The form calculation is probably going to do what you need, the only downside is that the business logic is stored in the form so if you made changes to the data in another app that doesn't use the form, the logic wouldn't apply.
Here's an example to calculate when the in progress date when the status changes to in progress:
if ((DomainName($originalFeature,"status") != DomainName($feature,"status")) && (DomainName($feature,"status") == "In Progress")) {
return Now()
} else {
return $originalFeature.inprogressdate
}
Right now, Field Maps doesn't support calculating and also editing the same field. It's something we're planning to support though.
Thanks @Anonymous User . I'll give your suggestion a try and let you know how it goes.
One additional question. When you wrote:
the only downside is that the business logic is stored in the form so if you made changes to the data in another app that doesn't use the form, the logic wouldn't apply
is the new Web Map Viewer an example of where the logic wouldn't apply? I'm imagining a single map that is available to our field crews working with Field Maps and our Admin staff working in the web map viewer. If i understand correctly, in that case both apps are reading the 'form' info from the map so it should work in both of those apps
Thanks again.
Yes, the new Map Viewer supports the same forms as Field Maps. There is a JavaScript editing widget, with form support, in the JavaScript API that Map Viewer and Experience builder use for editing.
This is still an issue. Looking forward to when this is supported: "Right now, Field Maps doesn't support calculating and also editing the same field. It's something we're planning to support though."