adith visnu
Posts: 0
Joined: Mon Jul 07, 2014 6:32 am

where condition list. am i wrong ?

i want to retrieve data from collections, and this is my javascript codes

var id = localStorage.getItem('id_device');

track.execute({ "data":{"where":'{"PIN":"usersdata":"addTracker","idPenambah":"'+id+'"}}'}});

Image

i want to retrieve data from 'usersdata' where in 'addTracker' have condition too.

*PIN in usersdata collections
*idPenambah in addTracker collections

Thankyou

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

where condition list. am i wrong ?

Hi Adith,

Please use following code instead of yours:

pre

var whereObject = {"PIN":"usersdata", "idPenambah": id};

track.execute({data: {where: JSON.stingify(whereObject)} });

/pre

Also i see you have some confuse in queries. Thus please take a look about queries here: http://devcenter.appery.io/documentat...

Regards.

adith visnu
Posts: 0
Joined: Mon Jul 07, 2014 6:32 am

where condition list. am i wrong ?

hi Yurii!
thanks for the answer. but there is an error.
that is : Uncaught TypeError: undefined is not a function. its referer to JSON.stingfy(whereObject).

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

where condition list. am i wrong ?

Adith,

Sorry this is a typo.

Here is right code:

pre

var whereObject = {"PIN":"usersdata", "idPenambah": id};
track.execute({data: {where: JSON.stringify(whereObject)} });

/pre

Regards.

adith visnu
Posts: 0
Joined: Mon Jul 07, 2014 6:32 am

where condition list. am i wrong ?

Hi yurii, nevermind for the typo.

could you explain your code?

adith visnu
Posts: 0
Joined: Mon Jul 07, 2014 6:32 am

where condition list. am i wrong ?

let me clear this questions.

its addTracker Collections
Image

and its usersdata collections
Image

i want to retrieve lat and lng from 'usersdata' which the PIN are retrieve idYangDiTrack from 'addTracker' collections

adith visnu
Posts: 0
Joined: Mon Jul 07, 2014 6:32 am

where condition list. am i wrong ?

let me makes my problem clearly

i want to retrieve :

Image

and my code is

track.execute({ "data":{"where":'{"PIN":"usersdata":"addTracker","idPenambah":"'+id+'"}}'}});

am i wrong?

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

where condition list. am i wrong ?

Hi Adith,

Nope, your code is not good. And will generate syntax error.

There is some things which is you need to know:

  1. You can not choose field to be returned in response. Whole entity will return.

  2. You can send request only to one collection. If you need information from two or more collections you need multiple requests.

  3. "Where" request parameter should be used when you need make some "search" in collection. See more about queries here: http://devcenter.appery.io/documentat...

  4. Also you can read about service execution(with JS code) here: http://devcenter.appery.io/documentat...

    Regards.

adith visnu
Posts: 0
Joined: Mon Jul 07, 2014 6:32 am

where condition list. am i wrong ?

Hi Yurii,

If i use your code above. its return null. I didn't know why.
And when i use multiple request as you said, it works..

I think this topics can you mark as "solved" topics

Thanks for the explain Yurii

Regards

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

where condition list. am i wrong ?

Adith,

Thanks for this update.

Regards.

Return to “Issues”