Unable to make foreign key field editable in Field Maps form

595
9
05-09-2022 09:54 AM
MollyMoore
Occasional Contributor

Is this a known issue or limitation? We've been using the same feature service to make our web maps to use in Collector and now Field Maps for years. Upon my last update/creation of the new web map where I configured the form in the new Map Viewer and then tried in Field Maps on the web, the field is not able to be enabled for editing. The only thing I can think of that is different about this field than the others is that it acts as a foreign key. I'm a bit baffled - does anyone have any info about this?

Tags (2)
0 Kudos
9 Replies
by Anonymous User
Not applicable

Are you using ArcGIS or ArcGIS Enterprise? If Enterprise, which version?

0 Kudos
MollyMoore
Occasional Contributor

I am using ArcGIS Online.

0 Kudos
by Anonymous User
Not applicable

Okay, I did a bit of digging and this is by design to help prevent orphan records from being created. Could you expand on your use-case a bit? This could be a restriction we consider relaxing.

0 Kudos
MollyMoore
Occasional Contributor

Thank you @Anonymous User ! It is helpful to know that. It would be really great for us to have the capability to edit foreign key fields in Field Maps as it has greatly impacted our workflow. Here's our use-case:

We have a rare species survey geodatabase. A polygon layer represents unique survey areas that are given a unique survey code that acts as primary key. All species observations that are found within a survey area are represented by points, lines, or polygons depending on the best representative spatial feature. The species observation feature classes are related to the survey features so they are all packaged together in the relationship (as well as some other ancillary data in related tables that are linked to the survey features). The workflow for our biologists includes collecting their species observation points, lines, and polygons and then delineating the related survey area when they get back in the office because they have a better idea of where they ended up surveying after they collect observations and have been out in the field. Since this change, it has been much harder for our field staff to find their records when they get back into the office because the survey code field is null when they create new features in the field. Let me know if you need any more info.

Thank you again for checking this out!

0 Kudos
by Anonymous User
Not applicable

I think you could use "spatial inheritance" via a form calculation  to auto-calculate/fetch the survey code. Since you have the polygon layer in the map and you have the new point, line, or polygon, you can do a spatial intersection to find the survey area polygon the current feature is in. Then you can extract the code attribute.

Form calculations only run when the field is non-editable in the form. So it should work for your foreign key field. Form calculation authoring is supported in ArcGIS Online and will be coming to ArcGIS Enterprise 11 later this summer.

I'm working on a blog post that contains an expression similar to what you want to do, you should be able to tweak it to your data and have it work.

 

// Create a feature set using the 'Regions' layer in the map
var regions = FeatureSetByName($map, 'Regions')

// Intersect the current location with the regions and 
// get the first region
var region = First(Intersects($feature, regions))

// If the current location does intersect a feature, 
// return the name of the region. Otherwise, return null
if (!IsEmpty(region)) {
    return region['name']
} else {
    return null
}

 Hope that helps.

0 Kudos
MollyMoore
Occasional Contributor

That is pretty cool and may work for some of our applications, but unfortunately likely won't work for this particular database because it is not uncommon for survey areas to overlap as our field staff will visit similar areas multiple times in a season or over the years. Or different field staff may visit similar overlapping areas to conduct surveys for different species.

0 Kudos
by Anonymous User
Not applicable

Ah okay, that's good to know. I'll log an enhancement for us to allow the foreign key to be editable - I can't promise we'll implement it though.

MollyMoore
Occasional Contributor

Great, thank you @Anonymous User. Appreciate your digging on this!

0 Kudos
EddyClark
Occasional Contributor

If I'm understanding correctly, then what I did was create a view layer of just the children.  Added that to the map then used example #7 from this link: https://www.esri.com/arcgis-blog/products/field-maps/field-mobility/common-calculated-expressions-fo...

0 Kudos