Wednesday, February 15, 2017

Creating Server Code Script on to access a Collection

In creating a mobile app based on back-end data in, server code that accesses a collection can be used as shown here.

In this post we start with a collection we created by importing a CSV file, FFD.csv.

We now create a Server Side script to access this collection.

In the platform  click on Server Code tab to open the user interface as shown.  In the script editor there may be some default code. Remove this script.


From the Snippets side click and add Retrieve all Objects. This inserts a line of code into the editor as shown below:

var result = Collection.query("dbId", "collectionName"); 

You need to insert correct values for the arguments. The JsonTest was the database in which the imported collection was saved. The imported CSV file was named as a collection with the name 'Custo'. The dbId parameter was found from the Settings tab for the JsonTest database


If the script is properly formulated you could Run the script. If there are errors you would see it in Trace info.


After the first line of code click return for a new line. In the Script Editor add another line of code to appear below the first line. For this choose the snippet, resposeSuccess.

This inserts this code:

Apperyio.response.success({"param1":"value1"}, "application/json");

Modify this code as shown below:

Apperyio.response.success(result, "application/json");

Click Save.


Click Save and Run. You should the response to the script in the panel as show below.


PowerShell Pro Tools is a Visual Studio Community 2017 extension that you can try free

I see there is at least one extension, PowerShell Pro Tools that you can download. You can find it in the Visual Studio Community 2017...