Select to view content in your preferred language

Arcade Pop Up Malfunctioning

272
6
Jump to solution
2 weeks ago
Labels (1)
MollyE
by
Regular Contributor

I am using an arcade script to calculate and format a popup in a map which calculates the area of a department across various regions (on the same level, facility, site, district) and also lists the other facilities that have units with that same department. So when you select a unit, it gives information on that unit, including the department it is allocated to, and then gives some square footage stats related to that department. The pop up works great when looking at it in Pro and in a web map, however when I use that web map in ExB, it does not always calculate the area correctly or list all the other related facilities. Because it works as expected in Pro and web maps (and for some units while in ExB) I'm fairly confident my script is fine, but I'm wondering if there is some issue with how Arcade works inside ExB? I tried to use WebApp Builder just to see, and the pop ups do not render anything at all. I have gotten the same results across multiple devices, in Chrome and Edge but I have not tried other browsers yet.

Here is how a pop up renders (correctly) in a Web Map:

MollyE_0-1758841657508.png

And the same feature in ExB (incorrect):

MollyE_1-1758841666329.png

Another example of a different error, in Web Map (correct):

MollyE_0-1758842275465.png

And the same feature in ExB (incorrect):

MollyE_3-1758841845134.png

 

If anyone has any ideas on what could be happening, I'd love to hear it.

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
MollyE
by
Regular Contributor

I was able to figure it out.

I switched out FeatureSetByName($map, "LayerName", ["fields"]) to  FeatureSetByName($datastore, "LayerName", ["fields"]).

Something about how the widgets in ExB will strip down the data if only using $map (I assume for quicker responses) and is meant to used more for things directly related to the individual map object, but $datastore access the data directly and does not strip away anything. 

View solution in original post

6 Replies
Bryan_krg
Occasional Contributor

You could try adding the following to your script:

Expects($feature, '*')

According to the help this "Requests all fields because the required fields may be based on unknown information"

Basically it requests all data for the feature and make sure is available before performing calculations.

It makes the popups slower but has helped me solve issues with my arcade scripts in the past.

MollyE
by
Regular Contributor

I really thought that was going to be it, but unfortunately it did not work. I appreciate the idea to try though, and it's good to know about that function.

0 Kudos
gis_KIWI4
Frequent Contributor

@MollyE  - This is weird. the Arcade should be set at the map level and ExB shouldn't really affect it.
The only other thing I can think of is spatial elements within arcade.
Are you using "touches" or "within" your arcade? I know the geometry is generalized sometimes depending on what scale you are at.

 

0 Kudos
MollyE
by
Regular Contributor

I am not,  but I am using the Shape__Area field and we have our own gross_area field calculated from our CAD data, and it matches up pretty exactly so I will try using the gross_area field instead and see how that goes. I don't think the Shape__Area changes on the fly when the geo is generalized but it's worth a shot.

0 Kudos
MollyE
by
Regular Contributor

I was able to figure it out.

I switched out FeatureSetByName($map, "LayerName", ["fields"]) to  FeatureSetByName($datastore, "LayerName", ["fields"]).

Something about how the widgets in ExB will strip down the data if only using $map (I assume for quicker responses) and is meant to used more for things directly related to the individual map object, but $datastore access the data directly and does not strip away anything. 

gis_KIWI4
Frequent Contributor

Awesome work! Learnt something new today.

0 Kudos