Manage results from multiple queries sandbox example setup

1243
10
03-18-2018 01:04 PM
MaddyKelley
New Contributor

Manage results from multiple queries | ArcGIS API for JavaScript 3.23 

I am interested in modifying the API javascript example above. I am confused on the maps and data the example is referencing. I have an ArcOnline map ready to go with shared polygon data. When I try to change the referenced map and data below the app breaks. I think I might be using the wrong formats. My map and data aren't 'Map Servers'. 

Any help would be appreciated

Sandbox example:

My web map:

http://dugis.maps.arcgis.com/home/webmap/viewer.html?webmap=e350b9fa73314f78b356aef06fc6308d 

0 Kudos
10 Replies
MunachisoOgbuchiekwe
New Contributor III

Hello Maddy, 

 

So you can start off with something like this https://jsbin.com/fohexopeyu/4/edit?html,js,output

Essentially, we do the following: 

  1. Load a Feature Layer into a web map.
  2. Set up a query and then run the Query Task. 
  3. We set an alert to show how many features are on the map. 
  4. On Feature Layer click, we pass the object id of the clicked feature to the query.objectIds and then do another queryTask. 
  5. Then the alert will show the area_name of the clicked feature. 

This sample is kind off rough and can be updated to be more efficient (like using just one queryTask instead of two and using Div's to show the result instead of an Alert). But I think it is a good start.