Experience Builder: Data View shared by Map Widget with Extent Filter and Filter Widget

643
1
05-26-2021 09:20 AM
gregcaceres
New Contributor

With Experience Builder, I understand Data Views can be used to declare a source for a widget without allowing the widget to affect the source itself (only to affect a view / snapshot of that source), as detailed here. My use case requires quick and easy user interface, so I want employ the Map widget "Extent Changes" trigger with the "Filter Data Records" action (akin to the "filter by extent" option available for several widgets in WAB).

I select my Action Data and it's respective Data View (I've created a view called Map Extent, identical in its content to the Default view), then under the Conditions section I enable "Query by current extent". This all works as expected; to test, I use a simple Text widget with a data connection to the same layer I selected as Action Data for the Map, and specified the Map Extent data view. Using dynamic content I print out a count of all the features in that layer (31k at a lesser extent, 69k at full extent), as expected.

My problem comes in when I try to set up a Filter Widget with this same data connection (ie the Map's Action Data layer and its Data View "Map Extent"). My Filter widget necessarily asks for values, offering a list of all Unique options. For demonstration, initially the Filter offers all ObjectIDs as filter options. A simple pan / zoom of the map results in a refresh of the Filter widget to read "No data". Expected behavior would be that a pan / zoom would refresh the options to be only those ObjectIDs that are visible in the current extent of the map.

Other cases where I've been able to replicate this unexpected behavior are with the Feature Info and Table widgets.

0 Kudos
1 Reply
gregcaceres
New Contributor

For those looking for a quick and dirty solution to this specific issue while we await widget updates or some clarification about Data Views in this context that I'm missing...

The workaround right now is to create a chart with a data connection to the action data for the map (as above it's the "Map Extent" data view). The chart updates as expected same as dynamic content for a text box. The chart output can then be used / treated as its own data view; this data view can be used as the data connection for the desired Filter.

For example, I want a Filter with a dropdown list of possible Status-es of the records in my current map extent. First I need to create a Chart which simply counts each Status in the current map extent ("Completed": 100, "Pending": 123, "Abandoned": 7). I create a Filter with a data connection to this Chart's output, and the result is a filter with a dropdown offering "Completed", "Pending" and "Abandoned".

Now say I zoom in to a concentrated area with several of these records. My map action has now filtered out data records such that the "Abandoned" status records are no longer visible in the map extent. My chart updates and the filter responds to the change in Chart output so that the dropdown no longer shows "Abandoned" as a status filter option.

As you can imagine, this can get unruly after more than a few kinds of Filters (not to mention I don't actually want to chart these things, only filter by them) so this is not a long term or even scalable solution.

0 Kudos