Page 1 of 1

User Profile update with no duplicate entries in the database? Is it possible?

Posted: Mon Jul 07, 2014 11:13 pm
by Alex Van Name

I was trying to create a similar page and the TODO list app helps to learn DELETE Services and the VIDEO #3 for DATABASE services to learn how to make the MESSAGE app was helpful.

I have a followup question to this.

I have 2 buttons, "delete profile" and "Update profile"

The only way I have been able to update is to first make a Delete Service that deletes the old profile, then posts the Updated profile. Ok that works well.

But, if there is no data, the Delete Services fails because there is no data to delete...and when a user visits the app for the first time, with no profile data inside, none of my "labels" or "inputs" show up...I only see the Buttons, and no data above the buttons.

Is there a way to make some kind of conditional setting?

The problem for me is that I am playing with the order of DELETE and CREATE and LIST services and once in a while, I create these loops, where a profile is LISTed and then another is CREATED. Sometimes at my best, I get two profiles stacked on top of each other. I just want one profile to display. I have stayed away from the pre-created user database with user_name and user_id. I made a separate database instead for a user profile.

Any ideas?


User Profile update with no duplicate entries in the database? Is it possible?

Posted: Mon Jul 07, 2014 11:52 pm
by Yurii Orishchuk

Hi Alex,

Now you have two services: delete and create.

But you need to use "update" instead of "create" when you need to update current user.

Please take a look here about update users service.
http://devcenter.appery.io/documentat...

So you don't need to delete users before update them.

Regards.


User Profile update with no duplicate entries in the database? Is it possible?

Posted: Wed Jul 09, 2014 5:22 pm
by Alex Van Name

ok, thank you. I now understand how to make the update,create, and delete buttons work.

I want to have a conditional response that checks if there is an Instructor Profile. If the Instructor Profile doesn't exist, I'd like to create a profile.

If the Instructor Profile DOES EXIST, I'd like to just list the profile.

How can I do that?


User Profile update with no duplicate entries in the database? Is it possible?

Posted: Thu Jul 10, 2014 2:50 am
by Yurii Orishchuk

Hi Alex,

If you need to search particular user by particular criteria you can use following solution:

1 Create getUsers rest service. See details: http://devcenter.appery.io/documentat...

2 Add to this service "where" parameter.

3 Populate this parameter with certain search criteria.

For example if in your Users collection you have custom field "role" and instructor user has in this field value "Instructor" you can user following "where" criteria to find all users with this criteria:

pre

{role: "Instructor"}

/pre

See details about "where" clause: http://devcenter.appery.io/documentat...

After you recive array of users with role "Instructor" you can make logic you need.

Regards.


User Profile update with no duplicate entries in the database? Is it possible?

Posted: Wed Jul 16, 2014 4:06 pm
by Alex Van Name

Thank you Yurii, I appreciate the advice.