Select to view content in your preferred language

Calculated Expression Not working to pull feature

345
1
11-09-2023 08:53 AM
DWebb
by
Emerging Contributor

I am doing inspections and I'm trying to pull in the facility name in the inspection table from the related layer. 

Here is the expression that I'm using, which displays when we test but not in the field map applications. 

var sitename = FeatureSetByRelationshipName($feature,"L1GI_Inspection_Sites" , ['fse_name'])
var site = First(sitename)
if (!IsEmpty(site)) {
return site['fse_name']
} else {
return null
}

0 Kudos
1 Reply
marksm_macomb
Frequent Contributor

A few other geonet posts have observed buggy things happening with FeatureSetByRelationshipName. I use the below expression using FeatureSetByID instead, with a filter to match primary key to foreign key and it works well for us:

var parent_id = $feature.ParentGUID_

var related_Manholes = FeatureSetById($datastore, "6",['GlobalID', 'FacilityID'], false)

var parent_Manhole = First(Filter(related_Manholes, 'GlobalID = @parent_id'))

if(parent_Manhole == null){
return
}
else {
return parent_Manhole.FacilityID
}
0 Kudos