Select to view content in your preferred language

How to show points in a list or table based on selecting area in Exp Builder?

357
8
Jump to solution
3 weeks ago
Yogesh_Chavan
Occasional Contributor

I have a map that contains a layer with all the power plants(points). There is also another layer that contains area (polygons). 

There are also two widgets, both of them lists. First list is showing all of the power plants, and the other one is showing the area. What I would want to do is to click one area on the map (or on the list widget), which would then select and/or filter all of the power plants on the power plant list widget, that are contained within that chosen area. Is there a way to do this?

We also have already tried this How To: Filter Records in a List Widget Based on Selected Records of Another List Widget i (esri.com... but this is not applicable in current use case. The problem is that the points data table does not contain information regarding which area the power plants belong to. A point may belong to multiple areas simultaneously as well, not just one. And the drawn areas will change from time time, not stay the same.

I know that it is possible to draw an area on the map (using the Select-tool), that would then select the points on the list widget, but that is not what is desired. I couldn't find a clear solution but tried to find my way around this using the Spatial filter-widget, but with no luck yet. 

1 Solution

Accepted Solutions
JeffreyThompson2
MVP Regular Contributor

After a few more iterations, I got a version that works from search and a mouse click.

https://community.esri.com/t5/experience-builder-tips-and-tricks/zone-lookup-in-experience-builder-a...

GIS Developer
City of Arlington, Texas

View solution in original post

8 Replies
TimWestern
Occasional Contributor

Are there multiple layers at work here, or just multiple features in the service?

I ask, because when I read the first part, I thought the obvious answer would be to do the select, and pull in results from the different layers and have each list then populate from the correct list, and use the selection to filter a separate query for each list?

It sounds like your data is a bit more complex than that though.  Where do the sources of data come from for the areas and power plants?  If both lists contain all of them, are you trying to do a selection in the list or table and then have it appear on map and highlight what power plants are in that area?  If you select on a powerplant are you trying to see which area(s) it belongs to? I'm not sure I understand the workflow as you are suggesting. It almost sounds like you might need something to toggle, which type of selection you are doing so you can then filter the underlying data source you want to query to get the selections.  (This almost sounds like it might need custom widget work to me)

Yogesh_Chavan
Occasional Contributor

Hello @TimWestern,

Thank you for looking into this.

What we would like to achieve is:

For example we have 2 layers in a map, one is USA states, and other is USA cities, and 2 list widgets showing all the states and cities respectively.

Now, let's say I select Alaska state polygon in the map, I would like to see only the list of cities in that state in the list widget.

0 Kudos
JeffreyThompson2
MVP Regular Contributor

Consider using the Zone Lookup Instant App if all your application needs to do is find power plants. It should be at least a 90% solution to the problem described above and it's very easy to set up.

I have been experimenting with a Near Me hack that will do what you want triggered from the Search Widget, but trying to trigger it from a map click will result in strange unpredictable results. It will be a lengthy and complicated explanation, so let me know if you are interested.

GIS Developer
City of Arlington, Texas
Yogesh_Chavan
Occasional Contributor

Hi @JeffreyThompson2,

Thank you for looking into this.

Sure, feel free to share the explanation for the select widget, and I can try that.

0 Kudos
JeffreyThompson2
MVP Regular Contributor

After a few more iterations, I got a version that works from search and a mouse click.

https://community.esri.com/t5/experience-builder-tips-and-tricks/zone-lookup-in-experience-builder-a...

GIS Developer
City of Arlington, Texas
Yogesh_Chavan
Occasional Contributor

Thank you @JeffreyThompson2, this is really helpful.

0 Kudos
JasminePrater
Occasional Contributor II

I was able to get this to work using three widgets - Map, Query, and List.  I added the Map widget, connected it to my desired online map, and made sure that the Select option was active.  I added the Query widget, selected a New Query using the map, and added my point layer.  In that widget, click Filter by > Selected features from data source option in that same menu.  I clicked Add filter layer and added my polygon feature.  I made sure the Spatial Relationship Rules was set for Intersect.  When I select my features in the map, the Query widget showed Selecting features from the data source (selected features in the map), the Choose a filter layer (polygon layer), and the Relationship as Intersect.  When you click Apply, it will provide a list of selected features.  If you would like to add a List widget, you can do so by connecting it to your Map widget using the point feature layer.  If you want some images to help, I can do so.  

TimWestern
Occasional Contributor

I figured there might be a more out of the box way to do this, but since my day to day is so often starting in custom widget code I didn't know how to articulate it.

I wonder though are all those settings server side? (meaning you edit them in dashboard and they are setup for everyone, vs You do the filtering on the client and maybe now you have a local cookie just for you for that setting?)

I would actually suggest if you've got this working well (sounds like you do), this would be a great candidate for a blog or article.  I'm sure many people are looking for how to do this at least partially out of the box.

0 Kudos