Select to view content in your preferred language

In Arcade is there FeatureSetByName but for tables?

1628
3
07-29-2019 02:44 PM
DougBrowning
MVP Esteemed Contributor

There does not seem to be an Arcade group for some reason so trying here.

I have been using FeatureSetByName for Feature layers and it works great.  But it does not seem to work for tables.  I just nothing back from it.

There is not a TableSetByName or anything like that.

So how can I query a table?  Tables are left out in the cold in Esri products a lot so I am afraid of the answer.

var sql = "PrimaryKey = '" + $feature.PrimaryKey + "'";
var tbl = Filter(FeatureSetByName($map,"Photos"), sql);


var link = ''
for (var f in tbl) {
    link = f.PhotoLink
}
return link

tbl comes back blank

thanks

0 Kudos
3 Replies
DougBrowning
MVP Esteemed Contributor

I should also note we are only doing this because the relationship/PhotoLink works randomly sometimes and not others.  Sometimes it auto changes to a link and then we republish and it is gone.  Cannot find the pattern yet.

thanks

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi Doug Browning ,

The FeatureSetByName function works for both feature layer and tables. If you have a look at the post below, you will see that the access to "related" is established by using the FeatureSetByName using the exact name used in the $map  (in this example there isn't even a relationshipclass between the two):

https://community.esri.com/docs/DOC-12773-using-featuresetby-functions-in-arcade-to-drill-down-to-ot...

Just scroll down to the second expression where a table "hist_mantenimiento" is accessed.

If your primary key is a GlobalID, your SQL expression will probably be different.

0 Kudos
DougBrowning
MVP Esteemed Contributor

Thanks.  It turned out to be that the map was zoomed into a point that just happened to have no PhotoLink.  So it was returning a blank set - but not for the reason I thought.  I have had issues with FeatureSet vs RecordSet before where RecordSet was not working so I just thought it was the same issue.  (see this post https://community.esri.com/thread/213089-using-a-agol-hfs-in-python-directly )

Seems to work now.

Thanks