I am trying to use the Text Widget in Experience Builder Developer Edition (ArcGIS Enterprise 10.7.1) using Dynamic Content to return data using specific fields. I am trying to return a "0" if a selected address (Point) falls in a specific City Limits (Polygon) and an "2" if it falls outside them. Maybe using a if / else statement. I can't seem to get it to work. Is this possible or is the Dynamic Content Expression only limited to the Expression Functions Average, Count, Sum, Max, and Min? I was also thinking I could use a Count function using a view saying if the count is greater than 0 return "0" else return "2". I wasn't able to get that to work either. Is there a way to do this in the Text Widget or some other way to do this? Any help would be appreciative. Thank you in advance!
Hi @bphillips ,
The text widget supports Arcade expressions in the June 2025 AGOL release.
You can connect the text widget to both the point and polygon layers and use a similar script:
// SelectedPts is the selected address (Point)
var selectedPts = $dataSources["dataSource_id1"].selectedFeatures;
// If no point is selected
if (Count(selectedPts) == 0) {
return "No features selected."
}
// Specific City Limits (Polygon)
var cityLimits = $dataSources["dataSource_id2"].layer;
var cityPoly = First(cityLimits);
// Check to see if there are any selected features within the polygon.
var insidefeatures = Contains(cityPoly, selectedPts);
if(Count(insidefeatures) > 0) {
return "The selected point falls inside the polygon.";
}
else {
return "No selected point falls inside the polygon.";
}
Please let me know if you have other questions.
Regards,
Shengdi