Greetings all,
For an AGOL hosted feature layer, I've created a form for field workers to inspect catch basins for cleaning and functionality of the grate. The entire thing works great except I want the final question/status of the inspection, to default to “Incomplete” if the response to the first question in the form is anything other than "Accessible". To be clear, this isn't a question of it being visible upon the condition, more of an attribute rule/contingent value issue. I want it to default specifically to "Incomplete" value based on the first question response being anything other than "Accessible". Is it possible to make this happen by inserting an "IF" statement by editing the JSON for the web map in ArcGIS Assistant? If so, what is the proper syntax within JSON? If it’s possible, I suspect it would fit in somewhere as shown below? (Obviously this syntax is incorrect.)
Thx in advance for any help.
Solved! Go to Solution.
Hey Kerri,
Thanks so much for chatting with me at UC2024 and providing guidance to a Field Maps Designer newb. The beginning of the answer to my question is below and, of course a simple arcade statement. I’ve managed to apply much more to the form to ensure that quality data is collected which will eliminate cleanup at project’s end. Thx again.
When(
$feature.Access_Status != "Accessible", "Incomplete",
$feature.Sediment_Fill == 9999, "Incomplete",
$feature.Frame_Grate_Action == "Inaccessible", "Incomplete",
$feature.Adjustment_Units_Action == "Inaccessible", "Incomplete",
$feature.Precast_Structure_Action == "Inaccessible", "Incomplete",
"Complete")
Hi Scott,
I highly recommend creating your expression in Field Maps Designer. It will appropriately JSONify your expression and insert the necessary syntax and references.
If you are truly wanting to do this in the JSON yourself. It would look like the following.
Your expressions don't belong with the fields, they belong in the ExpressionInfos section of the JSON. Your fields reference them.
Hi Scott,
If your field workers are using Field Maps, you can use Arcade in the Field Maps Designer. You can add your If statement to the final question, however if you do you an Arcade expression on the field, it will be a read only field, so you might want to use an if/else or IIF statement to calculate what the status would be. For example, if the only two options are Complete and Incomplete, you could use the following IIF statement:
IIF(DomainName($feature,ACCESS_STATUS) == Accessible, 'Complete’, ‘Incomplete’);
In this case, if Access Status is Accessible, the final question will be marked as complete, if it is anything else besides Accessible, it will be marked as incomplete.
I hope this is helpful. If you have any additional questions, please let me know.
Thank you,
Kerri
Kerri and Justin,
Thank you both so much for the quick reply. Since I didn't feel I had enough time to recreate the entire form in Field Maps versus within the map I decided to go the edit JSON route. The editing itself went fine but when I tested it in Field Maps the status field did not populate with either “Complete” or “Incomplete”, although I got no error. Also, I realized while I was testing the change that multiple “if” statements are required to auto-populate additional fields based on other responses to ensure complete and accurate data. Is this functionality more feasible within Field Maps, is there more control/options other than conditional appearance of a group, or am I describing a custom script to be written in JSON?
From what I've read for calculated expressions i don't see that I can preform what's required; a field to be editable and yet calculated if a previous question returns a particular answer since if it's calculated it can't be editable.
Scott
Hi Scott,
Using Field Maps Designer will give you much more than just conditional visibility of a group or a field. You can use Arcade to create calculations for fields (ex. the If statement from your original post). However, you are correct that if you create a calculated expression, that field is now read-only. In Field Maps Designer you can also set default values for questions, which would allow the field to still be edited. Can you tell me more about your workflow? You can either post it here or send an email to arcgisfieldmaps@esri.com
Thank you,
Kerri
Hey Kerri,
Thanks so much for chatting with me at UC2024 and providing guidance to a Field Maps Designer newb. The beginning of the answer to my question is below and, of course a simple arcade statement. I’ve managed to apply much more to the form to ensure that quality data is collected which will eliminate cleanup at project’s end. Thx again.
When(
$feature.Access_Status != "Accessible", "Incomplete",
$feature.Sediment_Fill == 9999, "Incomplete",
$feature.Frame_Grate_Action == "Inaccessible", "Incomplete",
$feature.Adjustment_Units_Action == "Inaccessible", "Incomplete",
$feature.Precast_Structure_Action == "Inaccessible", "Incomplete",
"Complete")