Page 1 of 1

How do you set up data pagination, connecting to an external DB?

Posted: Sat Feb 21, 2015 9:33 pm
by amse .

I'm new to app development, so I'm not sure if my question makes sense. When a user clicks a button in our app (or searches for a value), I'd like it to retrieve values from an external database. For simplicity sake, let's use a csv located in a local directory.

I think I follow in that I'll need to set up a REST service, and set up query parameters to return only values in a given field within this external table that match it. Am I on the right track?

Thanks!


How do you set up data pagination, connecting to an external DB?

Posted: Sun Feb 22, 2015 5:14 am
by M&M

yup, you are. Here is a sample application that uses pagination

http://devcenter.appery.io/tutorials/...


How do you set up data pagination, connecting to an external DB?

Posted: Sun Feb 22, 2015 4:18 pm
by amse .

Hi M&M, thanks for your reply.

I'm still a bit confused. A few questions:
In the link you provided, under the "Creating REST API Service", it appears the example imports a collection (table) into appery. How do you:

  • create a REST service that connects to a database, let's say located in a MySQL DB?

  • query that data to only return specific values, let's say in the form of a SQL query? Ex. when a user clicks the "Dog" button, an action is generated that queries the MySQL database, returns as all Dog values.

    Thanks!


How do you set up data pagination, connecting to an external DB?

Posted: Sun Feb 22, 2015 6:03 pm
by M&M
  • create a REST service that connects to a database, let's say located in a MySQL DB?

How do you set up data pagination, connecting to an external DB?

Posted: Sun Feb 22, 2015 6:04 pm
by M&M
  • create a REST service that connects to a database, let's say located in a MySQL DB?

How do you set up data pagination, connecting to an external DB?

Posted: Sun Feb 22, 2015 6:11 pm
by M&M

[quote:]

  • create a REST service that connects to a database, let's say located in a MySQL DB?
    [/quote]

    well, there is no direct way that I am aware of where you can connect an Appery App / front-end to a MySQL Database. You will have to provision some REST API / Setup to be able to do that - perhaps something like http://www.dreamfactory.com/

    [quote:]

  • query that data to only return specific values, let's say in the form of a SQL query? Ex. when a user clicks the "Dog" button, an action is generated that queries the MySQL database, returns as all Dog values.
    [/quote]

    The above is fairly easy. You can create a "where" clause in your request tab - when you create the REST API Service. Then pass the parameters dynamically at runtime.

    The example below passes couple of parameters to retrieve the data based on the category and Estate
    https://d2r1vs3d9006ap.cloudfront.net...

    You can dynamically assign the parameters using jQuery