This post was originally published at Updated: New features added to the Business App sample

Corona Business App - BlogThe Corona Labs Business App sample project has been updated with some frequently requested “How do I do this?” examples. A new data tab (and menu item) have been added for you. This new scene offers:

  • a tableView populated from selecting data from an SQLite database
  • tapping on a tableView row lets you edit the record and store the changes
  • tapping on the “Add” button lets you add new records to the database

To support these changes, a database abstraction module has been added that provides initialization of the database and basic CRUD operations (Create, Read, Update, Delete) for records in the database.

As part of the solution, you create a Lua table that defines your database scheme and the module will use that table for it’s operations.

Both the Update and Add screens provide examples of using  native.newTextField’s to input data and write to the database.

The code that populates the tableView uses MVC (Model, View, Controller) best practices to separate the data from the display.

The tableView's insert function provides the controller aspect so your onRowRender() function knows about it’s record and doesn’t have to know anything about how your data table is constructed and ordered.

Additionally a bug was fixed in the tableView refresh code to handle a case where your tableView didn’t have enough records in it and you tapped below the last record.

Download these new features today by visiting the project on the Corona Labs github repository. See how it can help you develop business style apps.

More here:  

This post was originally published at Updated: New features added to the Business App sample