Hey folks,
Long story long, I have a Many to Many documents table to parcel feature relationshisp. Using the FeatureSetByRelationshipClass function to get all the related Parcel GlobalIDs of the $feature (document) being edited and put them into an array. Then use that array to filter all the parcel features to later get some additional information. When I try to use that array in a Filter statement I get "Error: Invalid arcade expression, Arcade error: invalid where clause (GlobalID in ())".
Any thoughts?
Notes:
Line 17 I have to format the Array to adhere to SLQ.
If you don't you get the following error:
Invalid where clause (GlobalID IN (["{13C371EB-F80F-4B97-9718-D6CBCF37E8A5}","{4898F30A-5AEC-4BB1-A50C-59ED2FBCAF63}"])).
The format should look like (grabbed from ArcGIS Pro Select By Attribute SQL:
GlobalID IN ('{13C371EB-F80F-4B97-9718-D6CBCF37E8A5}', '{4898F30A-5AEC-4BB1-A50C-59ED2FBCAF63}')
// parcel_Documents Fields
var parcelDocumentsGlobalID_field = "GlobalID"
// parcel Fields
var parcelGlobalID_field = "GlobalID"
var parcelType_field = "type"
var relatedRecords = FeatureSetByRelationshipClass($feature, "parcel_Documents", [parcelDocumentsGlobalID_field], false);
var parcelFeatures = FeatureSetByName($datastore, "parcel", [parcelGlobalID_field ,parcelType_field], false)
var globalIDs = []
for (var record in relatedRecords){
var rg = record.GlobalID;
Push(globalIDs, rg);
}
var relatedParcelFeatures = Replace(Replace(Replace(globalIDs, '"', "'"),"[",""),"]","")
var filteredParcelFeatures = Filter(parcelFeatures, "GlobalID IN (" + relatedParcelFeatures + ")");
var cnt = Count(filteredParcelFeatures)
return {
"errorMessage": Text(cnt)
}
Any assistance from the community would be great. Thanks in advance!