Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

UPDATE some columns (ie PATCH)

Hello Steven,

Unfortunately this issue is still in progress. We'll post an update as soon as it will be fixed.

leven.steve
Posts: 0
Joined: Sun Mar 04, 2012 4:01 pm

UPDATE some columns (ie PATCH)

How about if I change the page JS code to call a server side script and pass it parameters of id, column name and new value can the server-side script update one column?

Example:
updateTimeSheet({"id":"xxxxxxxxxxxx","colName":"rate";"newValue":100});

and then have the server-side script do something like:
var _id=request.id;
var col=request.colName;
var newValue=request.newValue;

result.obj = Collection.updateObject(dbId, "Timesheet",_id,{col:newValue});

Would that work?

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

UPDATE some columns (ie PATCH)

Hello Steve,

No, it won't work. Please look at the Server Code below for that functionality:

prevar _id = request.get("id");
var col = request.get("colName");
var newValue=request.get("newValue");
var newObject = {};

newObject[col] = newValue;

result.obj = Collection.updateObject(dbId, "Timesheet", _id, newObject); /pre

leven.steve
Posts: 0
Joined: Sun Mar 04, 2012 4:01 pm

UPDATE some columns (ie PATCH)

Thanks Sergiy. I figured it would be the case to use server code and no doubt in time I will make all requests via server code.

I have already used something like this to update a password in the Users file so I know it will now work.

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

UPDATE some columns (ie PATCH)

Here is an update about the topic issue:

As a workaround you can use REST API ($http) invocation in AngularJS for your update service but it should be configured manually and it can't be used for our platform predefined services:
https://docs.appery.io/docs/appbuilde...

leven.steve
Posts: 0
Joined: Sun Mar 04, 2012 4:01 pm

UPDATE some columns (ie PATCH)

Thanks IIlya, I will look at that.
It may have been a little more helpful if you guys gave me that answer and link 3 months ago though!

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

UPDATE some columns (ie PATCH)

How can I pass input box data to server code?

Let's say that I want my user to update his email address or phone number on record. I navigate the user to an update page with input boxes for each of the records in the collection.

The user enters,,, e.g. a new phone number; leaves the rest of the fields blank, because user only needs to update the email record.

how to I accomplish this by pressing the update data button..

Note: I am using a jquery app

Thanks

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

UPDATE some columns (ie PATCH)

I got this to work thanks to Serhii. I am next trying go find a method for updating all profile related data. I am hoping that Serhii is assigned to help me with this new challenge also; Serhii is the man!

Mike

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

UPDATE some columns (ie PATCH)

Please use a simple mapping from your input component to the request parameter of the Server Code, which has to get this value: https://docs.appery.io/docs/appbuilde...

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

UPDATE some columns (ie PATCH)

Thanks Serhii, but I do not have a server code for the update. will something like this work:

var dbApiKey = "myDBKey";
var result = Collection.updateObject(dbApiKey, "UserProfile", "_id", {
"email_address": "a href="mailto:user1@myapp.com" rel="nofollow"user1@myapp.com/a",
"phone_number": "111-222-3333",
"accunt_recovery_code":"1777",
"post_address":"301 elm street, MA 10023"
});
I'd like to be able to update as many fields as the users needs to update from inside the server code.

I tried mapping but it did not work for me.

Thanks

Mike

Return to “Issues”