Select to view content in your preferred language

What is the best way to combine 2 layers in a query?

364
1
11-01-2024 12:09 PM
PortWatchIMF
Occasional Contributor

Hello!

I'm looking for recommendations. I have this set up where I query a layer and then create a chart. 

However, I have a second layer I would like to query at the same time and ideally wait to have both responses before creating my custom chart. Does anyone know how I could achieve that?

Thank you

require(["esri/layers/FeatureLayer", "esri/rest/support/Query"], (FeatureLayer, Query) => {
const layer = new FeatureLayer({url: layerURL });

const query = new Query({where: /* query params */});

layer.queryFeatures(query).then((result) => {
createCustomChart(result.features); /* Create my custom chart and display it */ 
});
})

 

0 Kudos
1 Reply
DuncanC
Frequent Contributor

Edited answer.  Nest the second inside the then block of the first.

0 Kudos