Page 1 of 2

Need help with a query through a local variable.

Posted: Thu Jul 11, 2013 7:41 pm
by Ralph Smith

Need help with a query through a local variable.
Hi folks, I'm lost and need some help. I'm assisting a group of high school students create an Android app for a non-profit organization. We've used the example in the tutorial to do a signin for the users. We then built a collection that has multiple records per user and includes their activities (date, times, etc). After the user logs in we simply want to display their activity data and allow them to add/change/delete but we can seem to get the database query to work to only present their records. I'm getting and error on the query (my programed alert is being displayed). Here are the pictures (worth 1000 words). Image


Need help with a query through a local variable.

Posted: Thu Jul 11, 2013 7:48 pm
by Ralph Smith

Whoops. Looks like only one of the images was uploaded. Here's another. Image


Need help with a query through a local variable.

Posted: Thu Jul 11, 2013 7:49 pm
by Ralph Smith

Here's another picture. Image


Need help with a query through a local variable.

Posted: Thu Jul 11, 2013 7:50 pm
by Ralph Smith

REST Reponse Image


Need help with a query through a local variable.

Posted: Thu Jul 11, 2013 7:50 pm
by Maryna Brodina

Hello! Thank you, we'll take a look and update.


Need help with a query through a local variable.

Posted: Thu Jul 11, 2013 7:51 pm
by Ralph Smith

Welcome screen capture. There's a label that should list the users name under Welcome Image


Need help with a query through a local variable.

Posted: Thu Jul 11, 2013 7:52 pm
by Ralph Smith

Welcome screen service request. Image


Need help with a query through a local variable.

Posted: Thu Jul 11, 2013 7:53 pm
by Ralph Smith

Finally, the welcome Screen response. this is supposed to update the user name on loading the screen. Image


Need help with a query through a local variable.

Posted: Thu Jul 11, 2013 8:14 pm
by Maryna Brodina

1) Query request to DB returns objects array. Even if there is one object it's still in array. That's why it's better to map $ to Grid or List with Label.
2) You have incorrect "where" parameter - you pass to this parameter saved id, but it should be JSON. For example you can add JS in mapping to "where" with the following code:
codereturn '{"id": "' + value + '"}';/code


Need help with a query through a local variable.

Posted: Thu Jul 11, 2013 9:53 pm
by Ralph Smith

Marina, thank you very much for your support. I added the JS code as you suggested. Mine reads "return '{"local_user_id": "' + value + '"}'; ". I also added a grid and tried having the Fullname field from the collect mapped to the grid, but nothing actually shows up there so I'm not sure it really working still. sorry to be such a rookie.