query multiple layers

6184
4
Jump to solution
05-21-2015 06:51 AM
PeggyCorey
New Contributor

Can anyone please tell me...  how can you perform a Query/QueryTask on multiple layers?  I know you can perform a Find/FindTask on multiple layers by including multiple numbers in the array: findParams.layerIds = [0,1,2].  But I can't find the equivalent for Query/QueryTask.

Thanks for any help!

0 Kudos
1 Solution

Accepted Solutions
JakeSkinner
Esri Esteemed Contributor

Hi Peggy,

Here is a sample that demonstrates this.

View solution in original post

4 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Peggy,

Here is a sample that demonstrates this.

PeggyCorey
New Contributor

Thanks Jake, Todd and thejus. 

All replies were helpful.  I'll try to work my way through using PROMISES - Yikes!

0 Kudos
ToddBlanchette
Occasional Contributor II

Hi Peggy,

See if this can help Manage results from multiple queries | ArcGIS API for JavaScript

[Edit: Jake's answer is the same as mine, he fired it up while I was writing this ]

Cheers,

Todd

thejuskambi
Occasional Contributor III

You can not query on multiple layers at the same time. What you could do is query on each layers and combine the results together using the dojo/promise/all as discussed in this thread

How to nest dojo async calls and wait until all are complete

Only instead of layer.queryFeatures your need to use QueryTask for each of the layers.