Select to view content in your preferred language

Arcade question for ArcGIS Online Pop-ups

238
1
05-12-2023 11:38 AM
khenapart
New Contributor

Hi,

This question is in regards to configuring information in pop-ups on a web map in ArcGIS Online.

I have two layers and want one of the layers to show information on a pop-up that is related to the other layer.

For example, in layer A, I have a list of programs and what type of programs they are and also which building they belong to.

In layer B, are all the buildings.

I want to be able to click on a polygon in layer B and have it display all the programs and types of programs that are in layer A.

Essentially by clicking on a building, I want it to display all available programs within that building.

Any help on this is much appreciated! Thanks.

0 Kudos
1 Reply
jcarlson
MVP Esteemed Contributor

Assuming there's a shared field between them, this should be easy enough.

var id = $feature['building_id']

var programs = FeatureSetByName(
    $map,
    'programs_layer_name',
    ['program'],
    false
)

// filter program layer by matching building id
var bldg_programs = Filter(programs, `building_id = '${$feature['building_id']}'`)

var out_arr = []

// push each program into array
for (var p in bldg_programs) {
    Push(out_arr, p['program'])
}

// return concatenated string
return Concatenate(out_arr, '\n')
- Josh Carlson
Kendall County GIS