Ralph Smith
Posts: 0
Joined: Thu Jul 11, 2013 7:41 pm

Need help with a query through a local variable.

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

Ralph Smith
Posts: 0
Joined: Thu Jul 11, 2013 7:41 pm

Need help with a query through a local variable.

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

Ralph Smith
Posts: 0
Joined: Thu Jul 11, 2013 7:41 pm

Need help with a query through a local variable.

Here's another picture. Image

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Need help with a query through a local variable.

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

Ralph Smith
Posts: 0
Joined: Thu Jul 11, 2013 7:41 pm

Need help with a query through a local variable.

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

Ralph Smith
Posts: 0
Joined: Thu Jul 11, 2013 7:41 pm

Need help with a query through a local variable.

Welcome screen service request. Image

Ralph Smith
Posts: 0
Joined: Thu Jul 11, 2013 7:41 pm

Need help with a query through a local variable.

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

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Need help with a query through a local variable.

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

Ralph Smith
Posts: 0
Joined: Thu Jul 11, 2013 7:41 pm

Need help with a query through a local variable.

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.

Return to “Issues”