Hello,
I'm trying to add an attribute [FACILITYID] from another feature in my web map form.
I have added a form field for this (see above) and have created a calculated arcade expression that seems to work.
However, when I test this expression by creating a new point (hosted feature layer), the field just shows [object Object] and not the desired value from the other feature layer.
Hoping someone can help with this?
Solved! Go to Solution.
I ended up solving the issue I was having. When creating the AGO hosted feature layer, I ended up setting the Facility ID field to be not editable. Even though I could control the editing permissions of the form itself, because I still had the field in the table set to not edit, that prevented the form calculation from happening.
that's because you are returning an entire feature (i.e row) not a specific value in that row.
try changing:
return InspectCB to
return InspectCB['FACILITYID']
For the sake of learning - I would add: console(InspectCB) to line 4
then you can view the results in the console tab and see what it is doing
Thanks, but I have tried that and I get this error...
I've also used Console() and it too gave me nothing in the console menu. Just Null in the output.
I'm using a blank hosted feature layer to add new inspections on existing catch basins feature layer. I have editing disabled for that field I want to populate too. Wonder if there isn't something else going on.
I'm using the first example from this blog as a starting point...
https://www.esri.com/arcgis-blog/products/field-maps/field-mobility/common-calculated-expressions-fo...
From the example you have provided you are missing an ! in the if statement.
This means that it will equate to 'if empty is true, return the empty value'.
By adding the '!' it equated to if this is NOT empty, return true (and then the value)
if (!IsEmpty(region)) { return region['name'] } else { return null }
When I add the !, I don't get [object Object], but I do get an error stating the calculation failed.
So, there is something else going on that is causing this to fail.
I ended up solving the issue I was having. When creating the AGO hosted feature layer, I ended up setting the Facility ID field to be not editable. Even though I could control the editing permissions of the form itself, because I still had the field in the table set to not edit, that prevented the form calculation from happening.