Hello!
I have a stand-alone table in ArcGIS Online that I would like to link to a feature service. The table and feature service are not related but both contain a common field. Is it possible to use Arcade to pull back records from the table into the feature service popup where the records match? Any help is appreciated.
Thanks.
Yes, you can do this by using the Filter function. This code returne all the records in the table that have same attribute in the common field
var asset = $feature.theCommonField;
var fs = FeatureSetByPortalItem(
Portal('yourPortal'),
'itemId',
0,
['*'],
false
);
var related = Filter(fs, "theCommonField = @asset");
Hey @KenBuja, Thanks for this! Can you expand on it a bit and assist in setting my expression up? I'm assuming I'm inputting something wrong or missing something as I'm getting an error. Here's my setup below. The ID within the portal is the ID for the stand-alone table.
var asset = $feature.PWID;
var fs = FeatureSetByPortalItem(
Portal('https://njdep.maps.arcgis.com/'),
'e6854954c9a744e09a0cfbe777d20492',
0,
['*'],
false
);
var related = Filter(fs, "PWID = @asset");
What is the error that you're getting? Also, have you checked whether the layerId is correct?
The ID is correct. The error I get is "Test execution error: Unknown Error. Verify test data."
If you put in "return fs" between line 8 and 9 and hit the Run button in the upper left corner, do you get back a valid dataset?
I get the same error.
Either the itemId ('e6854954c9a744e09a0cfbe777d20492') or the layerId (0) is incorrect.
Ah, it looks like it was the layerID(0). I changed it to 1 and now it works but I dont seem to get any results in the popup. I added "return related" and see results in the expression box but again nothing in the popup.
If you know there should be related records, the next step would be to make sure the field name is correct in the Filter statement