Arcade FeatureSet Function to Display Related Data in Attribute Table...Not Working as Expected

07-22-2020 03:30 PM
Occasional Contributor


I'm using FeatureSetByID in an arcade expression to display attribute data from a related layer in my pop-ups and in the attribute table.  The pop-up functionality is working great, but I'm running into some issues with getting the related attributes to display in the attribute table in web map viewer, as well as in the attribute table widget in Web AppBuilder.

In order to view the attributes in the attribute table in web map viewer, you are required to click "Show" for each and every attribute, which obviously is not ideal when you have thousands of records.  See first Screenshot.

When I view the attribute table in Web AppBuilder, I instead see "[object Promise]" where my related attributes should display.  See second screenshot.

I'm wondering if I might be missing something in my arcade expression that would fix both of these issues.  Any assistance or input would be greatly appreciated.

Thank you!

PS, Here is a sample of the function I'm using to return related attributes:

   var relatedSite = FeatureSetById($datastore, /* Visual and Sample Survey Collections (Current) */ "0")

   var observNum = $feature["observation_number"]

   var badData = "Bad Data - Delete"

   var filterStatement = "observation_number = @observNum AND trap_status <> @badData"

   var hostFromSite = First(Filter(relatedSite,filterStatement))

   return hostFromSite.trap_type

2 Replies
Occasional Contributor II

Hi -- like you, we've had success displaying these Arcade attributes in the pop-ups, but their use seems to end there. I have the same experience as you, where you must click Show to calculate it in the web map attribute table, and see only  "[object Promise]" in Web App builder. We'd love to be able to view them in the attribute table or even better, have them export to csv as part of the layer.
I asked about this during the UC last week where it was suggested to instead apply these as Arcade-driven Field Calculations on the feature layer itself (Feature layer > Data tab > click on a field, "Calculate" > Arcade or SQL), which will go through and calculate the value for the entire dataset at once rather than on-the-fly via a click in the map. This works even for functions like Intersect or Within, even though they're not together as layers in a map. Concerns with that are scheduling it to update periodically, and not being a viable option for very large datasets.

So I'm here to see other replies and suggestions. Thanks!

New Contributor III

I am experiencing the same issue in a web app that I am trying to deploy as a proof of concept for my agency.  

I get the FeatureSetByID to work in the popup which is fantastic, but I am trying to implement it using the Public Notification widget, and when I try to create a mailer using the widget, all of the columns that I have created return [object Promise] instead of the value itself.  

Looking it up online, it seems that the code needs to include a "then" statement in order for this function to work all the way through into the end result.  Hopefully ESRI folks will see this and give this awesome functionality to us?

In my example we have parcels (about 400,000 throughout our jurisdiction) and we have a separate table of owner data with a common field "APN".  I want to be able to quickly and easily provide a frontend for our users that will allow searching spatially for one or many parcels, then return the owner data so they can make contact as appropriate for notification purposes.  

The data is a referenced dataset, not hosted feature layer, I have thought of creating a view as Brittany suggests except that I need it updated dynamically, not just a one time calculate.  

Thank you all for the awesome help you always provide!