Saving a database list into a local variable.
What exact data and in what order do you want it to be sorted?
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
What exact data and in what order do you want it to be sorted?
Like in the database. I want it to come out as 'name', 'email', 'phone', 'notes'. I don't need any of the other columns.
There is no option yet to specify which columns you want via REST API. You will get all the columns and you can decide which to display on the page.
I'm going to check how to do this via Server Code.
Here is how you can do it via Server Code:
resObject = Collection.retrieveObject(databaseId, collectionName, objectId, null);
response.success({
firstName: resObject.firstName,
lastName: resObject.lastName
});
Or use underscore’s pick (http://underscorejs.org/#pick) like this:
response.success(_.pick(dbObj, ‘firstName’, ‘lastName’));
Or you can delete items (columns) from the resulting array that you don't want to send to the client:
delete item.name;