Select to view content in your preferred language

Dashboard version

481
15
Jump to solution
2 weeks ago
BillKinkaid1966
Emerging Contributor

We are currently running version 11.3 while working in portal. I’ve been trying to configure a data expression in Dashboards with no luck. It turns out I believe that although we are in 11.3 our setup is still using Classic Dashboards. The number one clue is that there is no ADD DATA icon. All I see in the left pane is the following in this exact order.

  • Add element
  • View
  • Theme
  • Time and Region
  • Save

Attached you will find a basic image of a new freshly created Dashboard showing there is no ADD DATA icon (DashboardScreenshot.png). Can someone possibly tell me how we can get the new version of Dashboards added to the App Launcher (9 dots)?

Thanks in advance for any help you can provide.

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

When posting code, please use the "Insert/edit code sample" button. It's easier to read and copy the code.

A data expression must return a FeatureSet. Your code just returns an array of text strings.

// Portal URL
var portalURL = "https://gis.(COMPANY_NAME).com/portal";

// Feature Layer ItemID
var layerItemID = "itemID";

// Layer index (usually 0)
var layerIndex = 0;

// Fields to include
var fields = ["T4PERMIT", "COMMODITY1", "OD", "Length_Miles"];

// Get FeatureSet from portal item
var fs = FeatureSetByPortalItem(
  Portal(portalURL),
  layerItemID,
  layerIndex,
  fields,
  false
);

var grouped = GroupBy(
  fs,
  ["T4PERMIT", "COMMODITY1", "OD"],
  [{ name: "TotalMileage", expression: "Length_Miles", statistic: "SUM" }]
);
var finalResults = [];

for (var permit in Distinct(grouped, "T4PERMIT")) {
  var permitVal = permit["T4PERMIT"];
  var permitGroup = Filter(grouped, "T4PERMIT = @permitVal");
  var textBlock = "<b>T4 Permit:</b> " + permitVal + "<br>";

  for (var comm in Distinct(permitGroup, "COMMODITY1")) {
    var commVal = comm["COMMODITY1"];
    textBlock += "&emsp;• <b>Commodity:</b> " + commVal + "<br>";
    var commGroup = Filter(permitGroup, "COMMODITY1 = @commVal");
    for (var row in commGroup) {
      textBlock += "&emsp;&emsp;◦ <b>OD:</b> " +
      row["OD"] +
      " – <b>Mileage:</b> " +
      Round(row["TotalMileage"], 2) +
      "<br>";
    }
  }
  Push(finalResults, { attributes: { Permits: textBlock } });
}
return FeatureSet(
  {
    fields: [{ name: "Permits", type: "esriFieldTypeString" }],
    features: finalResults
  }
);

Using my test data, the code produces this list

2025-09-23_11-37-37.PNG

View solution in original post

15 Replies
CodyPatterson
MVP Regular Contributor

Hey @BillKinkaid1966 

I for some reason am blanking at where I've ever seen this add data button you're mentioning. I loaded up my 11.3 Dashboard and AGOL Dashboard and the way to add data is through adding the element, and then adding the data source to the element, is that what you would want to do? What kind of data expression would you want to add?

Cody

BillKinkaid1966
Emerging Contributor

I’ve been trying to run arcade through the create expression that pops up when you choose a List widget with the help of ChatGPT. I guess this is what I get for listening to ChatGPT saying there should be an add data button on the main page. It said it numerous times and was adamant about it being part of this. I know it exists in Experience Builder and took its word that it should exist in this version of Dashboards.

CodyPatterson
MVP Regular Contributor

Hey @BillKinkaid1966 

No worries at all! Sometimes the AIs can hallucinate or start attempting to interpret what they have unusually! With the New Expression button on the list widget you'll be able to create and load the arcade straight into there, it'll let you configure your list and other items through there!

Cody

BillKinkaid1966
Emerging Contributor

What’s funny is that’s what I was initially trying to do, but I can’t seem to get the arcade script correct for just calling the featureset that I want to use. The arcade expression keeps throwing an error that it doesn’t recognize it and I’m using the basic arcade script you can find on Esri. So that that’s what led me to using AI. Unfortunately I’m still back at square one.

0 Kudos
KenBuja
MVP Esteemed Contributor

Can you post your code?

BillKinkaid1966
Emerging Contributor

Yes, I will go ahead and post it and give an explanation of exactly what I’m trying to do. I will post it later today because I need to make sure the arcade is scrubbed, but still contains the steps we are trying to accomplish. Unfortunately I will not be able to provide a test data set due to the confidentiality of the work I am performing.

Hopefully the arcade I’m providing that I’m using inside the “Select a Layer” step for adding a List widget will be enough to determine why it isn’t executing. FYI, I do not get any of the red error rectangles in the scrollbar while adding the Arcade script in the expression editor. What happens is once I save it in the “Select a Layer” dialogue there is a black error triangle next to it (It’s actually to the left of the edit button (pencil icon)). When I hover over that black triangle it shows a message stating it can’t be used as the layer.

0 Kudos
BillKinkaid1966
Emerging Contributor

Ken,

I’m including the script in the body of this message below that I’m trying to use inside the Select a Layer dialog create an expression when you add a List widget. A quick note. Here’s what it’s trying to do. We have a T4PERMIT field. It groups all T4PERMIT field numbers together. Then under T4PERMIT it groups by a field called COMMODITY1. Then under that it groups by OD and sums all of the Length_Miles for those grouped OD records. Keep in mind in the example below this text there are no line spaces between any of the rows below the specific T4PERMIT. But when it starts a new T4PERMIT there will be a line space between the previous T4PERMIT block of data and the new one. So what should appear in the List widget should look similar to this example I’ve provided:

 

T4 Permit: 999999

     Commodity: Gas

          OD: 10.5 - Mileage: 14.5

          OD:12.5 - Mileage: 7.32

     Commodity: Crude

          OD:10.5 - Mileage: 9.63

 

T4 Permit: 999998

     Commodity: Gas

          OD: 6.625 - Mileage: 3.21

          OD: 8.625 - Mileage: 1.01

 

Thanks for taking a look!!!

 

// ==============================

// T4PERMIT Hierarchical List Widget Expression

// Each T4PERMIT is a separate row with commodities and ODs

// Bold labels, indentation, summed mileage

// ==============================

 

// Portal URL

var portalURL = https://gis.(COMPANY_NAME).com/portal

 

// Feature Layer ItemID

var layerItemID = "***********(ITEM ID)************”;

 

// Layer index (usually 0)

var layerIndex = 0;

 

// Fields to include

var fields = ["T4PERMIT", "COMMODITY1", "OD", "Length_Miles"];

 

// Get FeatureSet from portal item

var fs = FeatureSetByPortalItem(

    Portal(portalURL),

    layerItemID,

    layerIndex,

    fields,

    false

);

 

// Group by T4PERMIT → COMMODITY1 → OD

// Mileage aggregation uses the numeric field directly

var grouped = GroupBy(

    fs,

    ["T4PERMIT", "COMMODITY1", "OD"],

    [

        {

            name: "TotalMileage",

            expression: "Length_Miles",

            statistic: "SUM"

        }

    ]

);

 

// Build hierarchical text for each T4PERMIT

var finalResults = [];

 

for (var permit in Distinct(grouped, "T4PERMIT")) {

    var permitVal = permit["T4PERMIT"];

    var permitGroup = Filter(grouped, "T4PERMIT = @permitVal");

 

    var textBlock = "<b>T4 Permit:</b> " + permitVal + "<br>";

 

    for (var comm in Distinct(permitGroup, "COMMODITY1")) {

        var commVal = comm["COMMODITY1"];

        textBlock += "&emsp;• <b>Commodity:</b> " + commVal + "<br>";

 

        var commGroup = Filter(permitGroup, "COMMODITY1 = @commVal");

 

        for (var row in commGroup) {

            textBlock += "&emsp;&emsp;◦ <b>OD:</b> " + row["OD"] + " – <b>Mileage:</b> " + Round(row["TotalMileage"], 2) + "<br>";

        }

    }

 

    Push(finalResults, textBlock);

}

 

// Return the array of strings — each T4PERMIT is a separate row in List widget

return finalResults;

0 Kudos
KenBuja
MVP Esteemed Contributor

When posting code, please use the "Insert/edit code sample" button. It's easier to read and copy the code.

A data expression must return a FeatureSet. Your code just returns an array of text strings.

// Portal URL
var portalURL = "https://gis.(COMPANY_NAME).com/portal";

// Feature Layer ItemID
var layerItemID = "itemID";

// Layer index (usually 0)
var layerIndex = 0;

// Fields to include
var fields = ["T4PERMIT", "COMMODITY1", "OD", "Length_Miles"];

// Get FeatureSet from portal item
var fs = FeatureSetByPortalItem(
  Portal(portalURL),
  layerItemID,
  layerIndex,
  fields,
  false
);

var grouped = GroupBy(
  fs,
  ["T4PERMIT", "COMMODITY1", "OD"],
  [{ name: "TotalMileage", expression: "Length_Miles", statistic: "SUM" }]
);
var finalResults = [];

for (var permit in Distinct(grouped, "T4PERMIT")) {
  var permitVal = permit["T4PERMIT"];
  var permitGroup = Filter(grouped, "T4PERMIT = @permitVal");
  var textBlock = "<b>T4 Permit:</b> " + permitVal + "<br>";

  for (var comm in Distinct(permitGroup, "COMMODITY1")) {
    var commVal = comm["COMMODITY1"];
    textBlock += "&emsp;• <b>Commodity:</b> " + commVal + "<br>";
    var commGroup = Filter(permitGroup, "COMMODITY1 = @commVal");
    for (var row in commGroup) {
      textBlock += "&emsp;&emsp;◦ <b>OD:</b> " +
      row["OD"] +
      " – <b>Mileage:</b> " +
      Round(row["TotalMileage"], 2) +
      "<br>";
    }
  }
  Push(finalResults, { attributes: { Permits: textBlock } });
}
return FeatureSet(
  {
    fields: [{ name: "Permits", type: "esriFieldTypeString" }],
    features: finalResults
  }
);

Using my test data, the code produces this list

2025-09-23_11-37-37.PNG

BillKinkaid1966
Emerging Contributor

Ken,

Thanks for the tip on the copying the code. I will definitely do that in the future. Also thank you for the quick reply. I’m out of the office today, but I will try this first thing in the morning and post back to you the results.

0 Kudos