Showing multiple records from one feature layer in a pop-up

278
1
09-20-2023 01:23 PM
Becca_
by
New Contributor II

I'm new to coding so I'm struggling to find any guidance on this. I know how to access data from one layer and show it in a pop-up for another layer, but now I'm trying to merge the multiple pop-ups for one polygon into one pop-up. 

BeccaKernahan_0-1695238451617.png

We use PolyID as our unique identifier. We have multiples records for the same polygon with different activity types listed. When I select a polygon on the map, I brings up multiple pop-ups, one for each record.

BeccaKernahan_1-1695238588613.png

I want all records for each PolyID to be shown in one pop-up ordered by planned year of activity. 

 Is this possible? If so, what would be the code to accomplish this?

0 Kudos
1 Reply
anbinh
by
Occasional Contributor

Hi,

 

First of all, I don't think the data structure you're using is efficient.

Technically, if I look at your ActivitySchedule table, your "PolyID" is not unique, then how can you use it as your "unique identifier"? Given that the data you are designing is actually "m to n" relationship that each polygon can have multiple activities, and each activity can be assigned to multiple polygons, considering the normal form rules of database design, I would design my polygon spatial layer to only have each unique polygon per record. Then I will have a non-spatial table/layer to record polygon IDs and activity ID/name per record. 

By having the above design, it will be easier to achieve what you want. Then you can use the technique of accessing data from another layer (table) to your pop-up. 

With your current data structure, I don't think it is possible to fully achieve what you want, because your same polygons are actually laying on top of each other, it will always have multiple pop-ups when you click one of the overlapping polygons. 

 

Hope this can give you some hint. 

 

Cheers,

Anbin

0 Kudos