Hello!
I'm creating a Field Maps collection form which includes a parent point layer as well as a related table. The parent point layer contains a UniqueID field which is a domain that the user will select. Is it possible to auto populate the remaining fields in the parent table from the information in the related table based on the UniqueID chosen? I think the "Fetch an attribute form a related table" from this page - https://www.esri.com/arcgis-blog/products/field-maps/field-mobility/common-calculated-expressions-fo... is the closest to what I'm looking for. Instead of populating the related table from the parent, I would like to auto populate the parent layer from the related table. Any help is appreciated.
Thanks.
What you want is the FeatureSet function like this
var tbl = FeatureSetByRelationshipName($feature, "Points", ['DesignLat'], false);
return First(tbl).DesignLat
Hope that helps
Thanks @DougBrowning,
This is what I have so far. I ended up using FeatureSetByName.
var related = FeatureSetByName($map, "pointlayer - points");
var uniqueid = $feature.uniqueid;
var relatedRecord = null;
if (uniqueid == '111111') {
relatedRecord = First(Filter(related, "uniqueid = '111111'"));
if (relatedRecord != null) {
return relatedRecord['Field1'];
}
} else if (uniqueid == '222222') {
relatedRecord = First(Filter(related, "uniqueid = '222222'"));
if (relatedRecord != null) {
return relatedRecord['Field1'];
}
}
return null;
So far this works and it auto populates the information from the related table Field1 into Field1 in the parent layer. I cant figure out how to return other fields at the same time. For example, I have the Field1, Field2, Field3, etc, that I would like to auto populate into the parent layer. Do you have any ideas as to how I can include these as well?
Thanks.
No you would need to do this for each field. I have upwards of 32 to populate all of mine. Well you could return them but you cannot store all that in one field so not sure what you mean.
Add the specific field you want and add the false part to not return the geometry and it will be faster like in my example. I am not sure why you are hard coding in the 1111 thing vs just calling by name but I guess you have a reason.
You can simplify this by using the UniqueID directly in your filter
var related = FeatureSetByName($map, "pointlayer - points");
var uid = $feature.uniqueid;
var relatedRecord = null;
relatedRecord = First(Filter(related, "uniqueid = @uid"));
if (relatedRecord != null) return relatedRecord['Field1'];
return null;
Hello i need help understanding this arcade expression. On the first line "pointlayer" would be the name of the parent layer? Also "points" where is that name coming from?
ByRelationship should be fixed now so you can use that.
FeatureSetByRelationshipName($feature, "Name of the Relationship class", ['list of fields'], false);
(the last false is to not return geometry to speed it up.)
Are you doing this expression in field maps designer?