Multiple Queries from Single View

3131
3
Jump to solution
07-17-2014 02:23 PM
KyleDunaway
New Contributor III

I have a viewController that gets multiple featureLayer objects from the mapController.

Lets say there are 2 feature layers i want to query.

Each feature layer has information that i want to access and put into a table.

I want to get a feature from 1 layer and compare to a feature from 2 layer.

When i query for the first feature it works fine, but when i query for the 2nd feature it blanks out the first and doesnt work.

The delegates or queryTasks or query are getting messed up.

Any idea the best approach for this?

Thanks

0 Kudos
1 Solution

Accepted Solutions
MichaelDavis3
Occasional Contributor III

Are you using two separate AGSQuery objects?  If not you may be overwriting the first query when you set up the second one.

View solution in original post

0 Kudos
3 Replies
MichaelDavis3
Occasional Contributor III

Are you using two separate AGSQuery objects?  If not you may be overwriting the first query when you set up the second one.

0 Kudos
KyleDunaway
New Contributor III

The way I am doing it now seems wrong but this is what i got.

Each feature layer has a queryTask and query.

I set the queryTasks to what they need to be with the URLs.

I set the query object to what it needs to be.

I dont know how to retrieve information from the didExecuteWithFeatureSetResults correctly.

To my understanding this gets called after each query.

Each time i query i want to save the feature into a variable, different variables for each query.

I was thinking a switch statement inside the didExecuute and set the variables accordingly.

Im also confused on where the delegates should be places, and if i only need one queryDelegate.

Thanks for the fast reply.

0 Kudos
KyleDunaway
New Contributor III

Your reply made me rethink the query and thus fixed my problem.  Thank you.

What i did was switch inside the didExecute on queryTask.

Thanks again.

0 Kudos