Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Query with local storage

You have to add this code manually.
E.g.: remove all arrows from the "where" parameter and add JS:
prevar studentId = Apperyio.storage.studentId.get();
var studentName = Apperyio.storage.studentName.get();
return '"$or": [{"studentId": ' + studentId + '},{"studentName": "' + studentName + '"}]}';/pre

Michael Ochakovsky
Posts: 0
Joined: Thu Oct 17, 2019 2:56 am

Query with local storage

How do I retrieve all db records for user bill.clinton from the 'UserProfile' collection. I have the current user '_id' saved into the 'myID' LSV.

The UserProfile collection has the following records:

first_name, last_name, dob, ssnumber, phone_number. etc

I have a page with input fields for all of the records named: 'UpdatePage'

on page load, the list service or query service runs and it display the last row on the collection; not the actual record for the currently login user: bill.clinton. It does show the bill.clinton _id, but it shows the last user in the collection, e.g. bruce.lee's data.

How can I fix this so the query service actually show the data for the current user?

Mike

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Query with local storage

Hello Michael,

Please use a simple query service with pointers values, so your parameter "where" should have a value, like:

pre{"user": {"collName":"UserProfile", "_id":"5458efdfe4b0c9bce12bd58a"}}'/pre

here "user" - the name of the column with a pointer to the collection "UserProfile"
"5458efdfe4b0c9bce12bd58a" - ID of your user, connected to the collection "UserProfile"
Please see this link for more details: https://docs.appery.io/reference#data...

Return to “Issues”