Hi everyone,
I'm trying to use arcade to pull the address from 3 features. I want to pull the address into the related table iterating through the 3 features and pulling the first one found. The address will be pulled based on the global ID
Code:
//create featuresSets for each Layer in the servicevar p1 = FeatureSetByName($map,"parcel (LogTest )")var p2 = FeatureSetByName($map,"building (LogTest )")var p3 = FeatureSetByName($map,"facilities (LogTest)")
//Filter your FeatureSets by Site IDvar GUID = $feature.GLOBALIDvar p1_filter = Filter(p1, "GUID = @$feature.GLOBALID")var p2_filter = Filter(p2, "GUID = @$feature.GLOBALID")var p3_filter = Filter(p3, "GUID = @$feature.GLOBALID")
//Return the address of the parent featureif(Count(p1_filter) > 0) {return First(p2_filter).Address}else if(Count(p2_filter) > 0) {return First(p3_filter).Address}else if(Count(p3_filter) > 0) {return First(p3_filter).Address}else{return null;}
var GUID = $feature.GLOBALID var p1 = FeatureSetByName($map,"parcel (LogTest )") var p1_filter = Filter(p1, "GUID = @GUID") if(Count(p1_filter) > 0) { return First(p1_filter).Address } var p2 = FeatureSetByName($map,"building (LogTest )") var p2_filter = Filter(p2, "GUID = @GUID") if(Count(p2_filter) > 0) { return First(p2_filter).Address } var p3 = FeatureSetByName($map,"facilities (LogTest)") var p3_filter = Filter(p3, "GUID = @GUID") if(Count(p3_filter) > 0) { return First(p3_filter).Address } return null
Thanks so much Johannes. I tired the code and made the necessary adjustments as you suggest but I got the error below;
Huh... No idea.
Does it work if you take care of the formatting yourself?
var where = `GUID = '${$feature.GLOBALID}'` var p1 = FeatureSetByName($map,"parcel (LogTest )") var p1_filter = Filter(p1, where) if(Count(p1_filter) > 0) { return First(p1_filter).Address } var p2 = FeatureSetByName($map,"building (LogTest )") var p2_filter = Filter(p2, where) if(Count(p2_filter) > 0) { return First(p2_filter).Address } var p3 = FeatureSetByName($map,"facilities (LogTest)") var p3_filter = Filter(p3, where) if(Count(p3_filter) > 0) { return First(p3_filter).Address } return null
No it generated same error
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.