Page 1 of 1

Using query responses as request parameters for another query

Posted: Sat Mar 01, 2014 2:43 am
by Homan Mohammadi

Hi,

I am trying to store the responses of a query in an array, so that I can then execute a different query that uses the array values as request parameters. I'm not sure how to get this to work. I currently have the following:
1) A query service
2) The following JS upon success of the service:
var m = JSON.stringify(data);

What I'd like to do next is take each "id" response (screenshot below) from this query, and execute a different service with it (i.e. iterate through all the "id" responses). Could you please help me figure out how to grab the "_id" values and iterate through them? I have attached a screenshot of the first query service below (ignore mapping please).

Thanks!

Image


Using query responses as request parameters for another query

Posted: Sat Mar 01, 2014 5:21 am
by Illya Stepanov

Hi Homan -

Thus you're invoking the service to list all "_id" from DB and then use each id as a request parameter?


Using query responses as request parameters for another query

Posted: Sat Mar 01, 2014 5:39 am
by Homan Mohammadi

Hi Illya,

Yes, that's exactly what I'm trying to do. I'm able to invoke the service, and save the data in a JSON, but I'm not sure how to run through all the id's and use them as request parameters.

Thanks!


Using query responses as request parameters for another query

Posted: Sat Mar 01, 2014 3:13 pm
by Igor

Hello,

You can save all id in one string and execute service with $in parameter.
http://docs.appery.io/documentation/r...
http://docs.appery.io/documentation/r...
or iterate through array and execute service for every element.
Small example how to invoke service with parameters:
https://getsatisfaction.com/apperyio/...