Is it normal behavior for a dashboard data expression to display "Unable to Execute Arcade Script" if it needs to return an empty feature set? When testing, the script executes as it should, it codes a dynamic indicator that at this point should display zero. Is there a workaround for this issue?
Can you post your script? Does it return an empty FeatureSet or the number 0?
What is your expression actually returning? Can you share the code?
Returning an empty data expression is possible, and works just fine.
It returns an empty feature set. I created another script that returns an empty feature set and that one indeed works fine (thanks, @jcarlson!). It might be something in the script (or data, or most likely portal). Here it is:
// declaring portal variable var portal = Portal("https://myportal.com/portal"); // filter work order feature set for required fields var fs = Filter( FeatureSetByPortalItem( portal, '3f959g85g959595954ff9ggkdkgr', 0, ["OBJECTID", "EQUIPMENT", "STATUS", "DATE_CREATED"], false, ), "STATUS LIKE 'Not Performed' AND PM_CODE LIKE 'SG-100SW-3'" ) //generating an array of equipment values that have consecutive Not Performed cycles var pairs = [] for (var r in fs) { var keys = r["EQUIPMENT"]; var values = r["DATE_CREATED"]; var keyvalue = {"key": keys, "value": values} Push(pairs, keyvalue) } var resultArray = []; for (var i = 0; i < Count(pairs)-1; i++) { var current = pairs[i]; var next = pairs[i + 1]; if (Equals(current.key, next.key) && Abs(DateDiff(Date(current.value),Date(next.value), "days")) <= 93) { Push(resultArray, current.key); } } //adding single quotes to the strings in the array so that the SQL filter recognizes them in order to match them to the equipment layer var newFilter = []; for (var i = 0; i< Count(resultArray)-1; i++) { var string = "'" + resultArray[i] + "'"; newFilter[i] = string } var eqFilter = `EQUIPMENT IN (${Concatenate(newFilter, ',')})` //filtering the equipment layer for the equipment values in the array return Filter(FeatureSetByPortalItem( portal, 'otmbd4968695gmb09fkv99vkvv', 0, ['*'], false, ), eqFilter)
This script works perfectly for two other PM codes, with 31, respectively 62 days.
Today my other two data expressions, which were working perfectly, display the same error. SO IT IS DEFINITELY NOT THE CODE. 😀 (This issue is related to the other issue I posted, with the chart built on a data expression not interacting with other dashboard elements, issue to which Josh answered.)
(Also: thank goodness for the Arcade Playground...)
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.