Issue with Arcade FeatureSetByRelationshipName

1280
2
10-25-2021 09:33 AM
Labels (1)
bjbertke
New Contributor
I am having trouble using the Arcade Data Function FeatureSetByRelationshipName() It seems that the function is not returning a FeatureSet that can be used by thte Count() function. I am using ArcGIS Pro v2.6.4 and it seems to work against a File Geodatabase but not for an Enterprise Geodatabase. I get an error on the line calling the Count() saying "Array type expected" ... Has anyone seen this or have any suggestions? var attachments = FeatureSetByRelationshipName($feature, 'rel_Structure_Attachments', ['globalid'], false); if (Count(attachments) > 0) { return "Relationships were found." } else { return "No relationship were found." }
0 Kudos
2 Replies
jcarlson
MVP Esteemed Contributor

There's actually a separate function for working with attachments. Have you attempted to use that?

https://developers.arcgis.com/arcade/function-reference/data_functions/#attachments

Even though the attachments are technically a related table, I don't think the application treats it as such.

- Josh Carlson
Kendall County GIS
0 Kudos
JohannesLindner
MVP Frequent Contributor

If you want to get attachments from an attachment table created by the EnableAttachments tool, then you should use the Attachments() function (as Josh said).

If your attachments are from a table created by a user, then I'd guess the problem is that you try to store the result of FeatureSetByName into a reserved variable name (Attchments). Try this:

 

// the name attachments is reserved for the Attachments() function
var attach = FeatureSetByRelationshipName($feature, 'rel_Structure_Attachments', ['globalid'], false); 
if (Count(attach) > 0) { 
  return "Relationships were found." 
} else { 
  return "No relationship were found." 
}

 


Have a great day!
Johannes
0 Kudos