Hi there,
I'm trying to get information from a table to a feature based on a related field.
The relationship is defined by a GUID field.
So basically I have a polygon layer called "Parcel" with a field for GlobalID. Then there is a table ("Permit") with additional information to this parcel. This "Permit" table has a field with ParcelID (= GlobalID from Parcel). There might be more than one matching permits to a parcel.
Is there a way I can configure the popup of the parcel in such a way that I can get some of the related fields from the permit table?
Just a note: There is no relationship configured (no relationship class has been setup)
Solved! Go to Solution.
Without a relationship class, you have to do the filtering yourself:
// load the permit table
var all_permits = FeatureSetByPortalItem(...)
// get the permits that belong to the parcel
var parcel_id = $feature.GlobalID
var parcel_permits = Filter(all_permits, "ParcelID = @parcel_id")
// return a default value if no permits were found
if(First(parcel_permits) == null) {
return "No permits found for this parcel"
}
// build your output
var output = []
for(var p in parcel_permits) {
var line = `Permit ${p.PermitNumber}, issued on ${p.PermitDate} to ${p.PermitOwner}`
Push(output, line)
}
// conctenate and return
return Concatenate(output, TextFormatting.NewLine)
Without a relationship class, you have to do the filtering yourself:
// load the permit table
var all_permits = FeatureSetByPortalItem(...)
// get the permits that belong to the parcel
var parcel_id = $feature.GlobalID
var parcel_permits = Filter(all_permits, "ParcelID = @parcel_id")
// return a default value if no permits were found
if(First(parcel_permits) == null) {
return "No permits found for this parcel"
}
// build your output
var output = []
for(var p in parcel_permits) {
var line = `Permit ${p.PermitNumber}, issued on ${p.PermitDate} to ${p.PermitOwner}`
Push(output, line)
}
// conctenate and return
return Concatenate(output, TextFormatting.NewLine)
Genius. Thanks!
Anyone know if there are plans to add a where clause to the FeatureSet calls like search cursor and other tools? I have posted it before but never a response.
The issue I have is some of my layers are 100K+ records. I know there is only the one record that matches my query but I have to grab all 100K then filter for the 1. With 30+ expressions in my popup it grinds to a halt.
Just add the filter to the call like this
FeatureSetByName(featureSetCollection, title, fields?, includeGeometry?, FilterQuery)
It would speed maps way up and maybe even make FeatureSet fast enough to enable it in symbology.
thank you
Sounds like a good enhancement, I just kudo'd your idea about this.
I'm not aware of any plans in this regard, but the ESRI staff in the Arcade related ideas isn't very communicative.
Can you provide a link to your idea?
thanks i should have posted it.