Select to view content in your preferred language

Push Arcade Expression Output to new expression

627
0
07-23-2021 06:18 AM
Status: Open
JasonGlidewell
Occasional Contributor

Many pop-ups used by my organization are powered by Arcade in AGOL. For cleanliness, we utilize HTML to design a table in the pop-up.  However, Arcade can not output the HTML for the table, meaning we must output one value, populated into one table cell, for each desired value.

Often these expressions run the same initial functions before deviating near the end.  This means we may have a dozen or more Arcade expressions that are identical for the first 50-60% of the expression, drastically increaing processing.

I would like to suggest Arcade expressions have the ability to take the output of Arcade expression 1 as the input for Arcade expression 2.

Example:

I have 400,000 points, consisting of hydrants and valves for a water network and 25 polygons representing service areas.  When I click a polygon, I want to know how many valves intersect the polygon and I want to know the count for each valve type.  I want this displayed in my pop-up in a table format.  Arcade can not output the HTML for the table format, so I must create several Arcade expressions, each outputting the count for a specific fix type.  If I have 10 valves types, this means I'll need 10 Arcade expressions, each one performing the filter to FeatureSetByPortalItem, asset type filter and Intersects().  This means it does the same thing 10 times.

The first half of my Arcade epxression will be the same for every expression.  FIrst I'll use FeatureSetByPortalItem to bring in the data and gemotry then I'll use a filter to get only valves, and a Intersects() to get the points intersecting the points within the polygon.  This process is repeated for every Arcade expression outputting the count of valves by type.

It seems it would be more efficent if I could make my first Arcade expression perform the FeatureSetByPortalItem, filter and intersect before feeding that FeatureSet into the subsequent Arcade expressions to filter by valve type.

Tags (2)