Page 1 of 4
Update and store
Posted: Thu Oct 24, 2013 1:21 pm
by Johnny
I want to do the following.
If the fields are empty store the fields. If it is not empty update them. All this from one button
How my app works:
User login - show list of categories(each category is a collection in the database) - user fill in data and store the data - user comeback and want to update the data by pressing on the same button as the store button.
Update and store
Posted: Thu Oct 24, 2013 2:55 pm
by Kateryna Grynko
Hi Johnny,
It depends on your Database structure. Is there one, several or no records for each user in each collection?
Update and store
Posted: Thu Oct 24, 2013 3:10 pm
by Johnny
No a row belong to a user. So each user have his own row.
Update and store
Posted: Thu Oct 24, 2013 3:13 pm
by Johnny
Sorry i dont what i was reading when awnsering
every user use every collection. And 1 row in every collection. A user start with no data.
Update and store
Posted: Thu Oct 24, 2013 3:14 pm
by Johnny
So first time user create his row in a collection and after that he must just update the info.
Update and store
Posted: Thu Oct 24, 2013 6:14 pm
by Kateryna Grynko
Johnny,
You would need to create three services:
Reads data from collection and saves result true/false, depending on whether there is a record for the user or not.
Saves data from input fields to Database.
Updates the data.
On Button click add the action - Invoke Service 1, then read the variable and run Service 2 or Service 3 depending on a variable value.
Update and store
Posted: Fri Oct 25, 2013 5:45 am
by Johnny
Ok I think I have it. Thank you!
Update and store
Posted: Sat Oct 26, 2013 1:21 pm
by Johnny
Katya,
Just want to know something about the update.
I create a local variable "objectid" I then open "list_service" and in the response tab I connect the "_id" to that "objectid" variable.
Am I connecting the wrong id? My project is still shared.
Update and store
Posted: Sat Oct 26, 2013 1:32 pm
by Igor
Hi,
If you want update the records you should use update service. Could you clarify what exactly do you want to do?
Update and store
Posted: Tue Oct 29, 2013 7:50 am
by Johnny
Sorry for the late reply.
Ok so my app can Store and List the data. Now I do the update and I thought I did it correctly but there is 1 problem.
I do not know how to explain this but I try.
After I added the update service and link the fields I noticed that when I login with different users the same data display. It was working perfectly before I added the update service.