Hi there,
I've got an Experience mainly consisting of a map that has one specific polygon feature layer for fire restrictions. The feature layer has a "Restriction Level" field, which contains the domain values Level 1, Level 2, and Level 3. In Map Viewer, there is always a filter (definition query) on this feature layer so that only polygons of one domain value are visible at a time, reflecting whatever level is in effect. To change the active level, I just change this filter in Map Viewer. Then headings on the Experience use Dynamic Content pull the first (random) polygon to list the domain value I've chosen to show, and ta-da, the map title now says, and the map itself now shows, Level 1 fire restrictions.
The feature layer has a nicely formatted popup that appears on the map when you click on polygons in the Experience, to tell you if fires are permitted or restricted in a given area. HOWEVER, the Experience also has a sidebar where I want to describe the specific rules for Level 1, Level 2, and Level 3. Ideally they'd have some formatting (numbered lists with some bold text). I want this sidebar to only list the rules for the level domain value that is currently showing on the map, though. How could I go about doing this? I can't just put the rules in a popup and connect to the popup because the popup is being used for something else. When I connect the text widget to the fire restriction layer data, I haven't had luck doing anything more complex with Dynamic Content that might let me show specific text under specific domain conditions. I thought there was recently some Arcade capabilities added in Experience Builder, but if I try to do Arcade in the Expression field, it just says the expression is invalid.
Do you have any ideas on how I might pull this off? Copilot ran me in circles with various nonexistent settings; I need a smart human!
Solved! Go to Solution.
Hi @Crinoid ,
Inserting an Arcade expression into a text widget should work. The Arcade script should be something like the following:
// Get the features currently selected on the map.
var selectedFeatures = $dataSources["dataSource_id"].selectedFeatures;
// Exit if no features are selected.
if (Count(selectedFeatures) == 0) {
return "No features selected.";
}
// Retrieve the first selected feature.
// (This script assumes only one feature is processed.)
var selectedPt = First(selectedFeatures);
// Get the level for the selected feature.
var level = selectedPt.PRestictionLevel;
// Return the corresponding level description.
if (level == "Level 1") {
return "Level 1 is .....";
} else if (level == "Level 2") {
return "Level 2 is ......";
} else {
return "Level 3 is ......";
}
Please let me know if you have other questions.
Regards,
Shengdi
Hi @Crinoid ,
Inserting an Arcade expression into a text widget should work. The Arcade script should be something like the following:
// Get the features currently selected on the map.
var selectedFeatures = $dataSources["dataSource_id"].selectedFeatures;
// Exit if no features are selected.
if (Count(selectedFeatures) == 0) {
return "No features selected.";
}
// Retrieve the first selected feature.
// (This script assumes only one feature is processed.)
var selectedPt = First(selectedFeatures);
// Get the level for the selected feature.
var level = selectedPt.PRestictionLevel;
// Return the corresponding level description.
if (level == "Level 1") {
return "Level 1 is .....";
} else if (level == "Level 2") {
return "Level 2 is ......";
} else {
return "Level 3 is ......";
}
Please let me know if you have other questions.
Regards,
Shengdi
You wouldn't believe how much of an idiot I am. I spent all this time trying to get dynamic content to work, and then a bunch more time trying to get AI to give me useless tips, then came to you, and in the end my whole issue is that I somehow missed that there's an Arcade button next to the Dynamic Content button. So much easier than I expected. I really appreciate you taking the time to help, because it turns out "just insert an Arcade expression into the widget" made me tilt my head enough to go back over to it and find the (now very obvious) button. Hope you have a great weekend.