<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ArcGIS Online Dashboard Data Expression — Still Grayed Out After Test Passes in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcgis-online-dashboard-data-expression-still/m-p/1609954#M11059</link>
    <description>&lt;P&gt;In Dashboards, a Data Expression must return a FeatureSet. Your code is returning a dictionary, but that has to be to converted into a FeatureSet for it to be used in the Dashboard.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;return FeatureSet({
    fields: [
        { name: "projectID", type: "esriFieldTypeString" },
        { name: "appropriations", type: "esriFieldTypeDouble" },
        { name: "encumbrance", type: "esriFieldTypeDouble" },
        { name: "expenditures", type: "esriFieldTypeDouble" },
        { name: "availableBalance", type: "esriFieldTypeDouble" }
    ],
    geometryType: "",
    features: features
});&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 29 Apr 2025 13:40:25 GMT</pubDate>
    <dc:creator>KenBuja</dc:creator>
    <dc:date>2025-04-29T13:40:25Z</dc:date>
    <item>
      <title>ArcGIS Online Dashboard Data Expression — Still Grayed Out After Test Passes</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcgis-online-dashboard-data-expression-still/m-p/1609859#M11057</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I'm building an ArcGIS Online Dashboard for dynamic Capital Improvement Project Budget Snapshot, and trying to create a &lt;STRONG&gt;Data Expression using Arcade.&lt;/STRONG&gt; I have three tables&lt;STRONG&gt;:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;Appropriations &lt;/STRONG&gt;(fields: &lt;STRONG&gt;projectguid&lt;/STRONG&gt;, &lt;STRONG&gt;fundamount_sum&lt;/STRONG&gt;)&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Encumbrances&lt;/STRONG&gt; (fields: &lt;STRONG&gt;projectguid&lt;/STRONG&gt;, &lt;STRONG&gt;Total_Encumbrance&lt;/STRONG&gt;)&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Expenditures&lt;/STRONG&gt; (fields: &lt;STRONG&gt;projectguid&lt;/STRONG&gt;, &lt;STRONG&gt;costamount_sum&lt;/STRONG&gt;)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Each table has about 350+ records. Every record represents a monetary value for a project that was created using a joined view between the project layer and it's funding or spending table, summarized as sums (&lt;STRONG&gt;except&lt;/STRONG&gt; for Encumbrances, which is a separate table with a single hardlined value), matched across the tables by projectguid.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Goal:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I want to calculate the sum total&amp;nbsp;&lt;STRONG&gt;Available Balance &lt;/STRONG&gt;for all projects within an indicator element using the formula&lt;STRONG&gt;:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Available Balance = Appropriations - Encumbrances - Expenditures&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I will use a &lt;STRONG&gt;List Element&lt;/STRONG&gt; in the same dashboard to select the project I want to &lt;STRONG&gt;filter&lt;/STRONG&gt; down to, which has a GlobalID that matches the projectguid.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Problem:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI&gt;My Arcade Data Expression runs successfully in "Test" (I get the expected features back).&lt;/LI&gt;&lt;LI&gt;But the expression is still grayed out and won't save in the Dashboard.&lt;/LI&gt;&lt;LI&gt;I have already added type: "FeatureSet" to my return.&lt;/LI&gt;&lt;LI&gt;I made sure all fields match the correct data types (String for projectID, Double for money fields).&lt;/LI&gt;&lt;LI&gt;I also cleaned my tables to remove records missing projectguid.&lt;/LI&gt;&lt;LI&gt;I use DefaultValue() to handle missing expenditures or encumbrances safely (treat missing values as 0).&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;My Code:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;// Load the tables
var appropriationsTable = FeatureSetByPortalItem(
    Portal('https://www.arcgis.com'), 
    'REDACTED_APPROPRIATIONS_ITEM_ID', 
    0, 
    ['projectguid', 'fundamount_sum']
);

var encumbrancesTable = FeatureSetByPortalItem(
    Portal('https://www.arcgis.com'), 
    'REDACTED_ENCUMBRANCES_ITEM_ID', 
    0, 
    ['projectguid', 'Total_Encumbrance']
);

var expendituresTable = FeatureSetByPortalItem(
    Portal('https://www.arcgis.com'), 
    'REDACTED_EXPENDITURES_ITEM_ID', 
    0, 
    ['projectguid', 'costamount_sum']
);

// Create lookup dictionaries
var encumbranceDict = {};
for (var e in encumbrancesTable) {
    encumbranceDict[e.projectguid] = e.Total_Encumbrance;
}

var expenditureDict = {};
for (var exp in expendituresTable) {
    expenditureDict[exp.projectguid] = exp.costamount_sum;
}

// Build the new feature set
var features = [];
for (var a in appropriationsTable) {
    var projID = a.projectguid;

    if (!IsEmpty(projID)) {
        var appropriation = DefaultValue(a.fundamount_sum, 0);
        var encumbrance = DefaultValue(encumbranceDict[projID], 0);
        var expenditure = DefaultValue(expenditureDict[projID], 0);

        var availableBalance = (Number(appropriation) - Number(encumbrance) - Number(expenditure));

        Push(features, {
            attributes: {
                projectID: Text(projID),
                appropriations: appropriation,
                encumbrance: encumbrance,
                expenditures: expenditure,
                availableBalance: availableBalance
            }
        });
    }
}

// Return final FeatureSet
return {
    type: "FeatureSet",
    fields: [
        { name: "projectID", type: "esriFieldTypeString" },
        { name: "appropriations", type: "esriFieldTypeDouble" },
        { name: "encumbrance", type: "esriFieldTypeDouble" },
        { name: "expenditures", type: "esriFieldTypeDouble" },
        { name: "availableBalance", type: "esriFieldTypeDouble" }
    ],
    geometryType: "",
    features: features
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What I’ve Checked:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;All projects have a projectguid&lt;/LI&gt;&lt;LI&gt;Money fields are properly formatted numbers&lt;/LI&gt;&lt;LI&gt;Test results show 291 features returned&lt;/LI&gt;&lt;LI&gt;availableBalance math is correct&lt;/LI&gt;&lt;LI&gt;No missing required attributes&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;Question:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;What else could cause a working Arcade Data Expression to remain grayed out in ArcGIS Dashboards, even after a successful test run?&lt;/P&gt;&lt;P&gt;Are there additional Arcade quirks or hidden Dashboard requirements I might be missing?&lt;/P&gt;&lt;P&gt;Thanks so much for any help or ideas!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Apr 2025 00:15:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcgis-online-dashboard-data-expression-still/m-p/1609859#M11057</guid>
      <dc:creator>Cierra_Scriven</dc:creator>
      <dc:date>2025-04-29T00:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Online Dashboard Data Expression — Still Grayed Out After Test Passes</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcgis-online-dashboard-data-expression-still/m-p/1609954#M11059</link>
      <description>&lt;P&gt;In Dashboards, a Data Expression must return a FeatureSet. Your code is returning a dictionary, but that has to be to converted into a FeatureSet for it to be used in the Dashboard.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;return FeatureSet({
    fields: [
        { name: "projectID", type: "esriFieldTypeString" },
        { name: "appropriations", type: "esriFieldTypeDouble" },
        { name: "encumbrance", type: "esriFieldTypeDouble" },
        { name: "expenditures", type: "esriFieldTypeDouble" },
        { name: "availableBalance", type: "esriFieldTypeDouble" }
    ],
    geometryType: "",
    features: features
});&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 29 Apr 2025 13:40:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcgis-online-dashboard-data-expression-still/m-p/1609954#M11059</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2025-04-29T13:40:25Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Online Dashboard Data Expression — Still Grayed Out After Test Passes</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcgis-online-dashboard-data-expression-still/m-p/1610065#M11060</link>
      <description>&lt;P&gt;You're absolutely right. I had thought I had FeatureSet in there and did not. Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Apr 2025 16:41:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcgis-online-dashboard-data-expression-still/m-p/1610065#M11060</guid>
      <dc:creator>Cierra_Scriven</dc:creator>
      <dc:date>2025-04-29T16:41:53Z</dc:date>
    </item>
  </channel>
</rss>

