Updated: New features added to the Business App sample

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.

Rob Miracle
[email protected]

Rob is the Developer Relations Manager for Corona Labs. Besides being passionate about helping other developers make great games using Corona, he is also enjoys making games in his spare time. Rob has been coding games since 1979 from personal computers to mainframes. He has over 16 years professional experience in the gaming industry.

13 Comments
  • Kiffin Ayers
    Posted at 11:45h, 08 March

    Great addition! Thanks!

  • John
    Posted at 17:26h, 08 March

    Another great addition would be a built in search bar on the tableview widget 🙂

    • Rob Miracle
      Posted at 18:22h, 08 March

      I’m considering adding that in a future version however, I can’t take away all the fun for you 😉

  • Marcus
    Posted at 17:44h, 08 March

    It will be really nice to show how to do a swipe to delete a row. This is a pretty common operation for a business app.

    • Rob Miracle
      Posted at 18:22h, 08 March

      Good idea.

  • Yang
    Posted at 19:13h, 08 March

    Hey Rob,
    I think a good addition to the business app would be the possibility to add an account and sign in with it (using a local database) in order to show another screen, which would also cover password encryption.
    Of course this might not be necessary if there already is a sample for this, I just can’t seem to find one.

  • Kerem
    Posted at 15:56h, 10 March

    Great work Rob. I like the idea of a CRUD abstraction module. Keep it up!

  • brindleware
    Posted at 10:00h, 14 March

    How about a coronium version?

    • Rob Miracle
      Posted at 16:11h, 14 March

      I will probably do that once we release the Coronium based Corona Cloud.

  • Paul
    Posted at 12:25h, 17 March

    Great timing, I needed a business app example. 🙂 Thank you!

  • vikas
    Posted at 07:29h, 05 August

    Hi Rob.. Thanks for adding great features in the updated version. I’m new to corona and learning lua. I just want to ask that how do I add a ‘Delete’ button on ‘edit account’ screen just like ‘Submit’ button to delete that record from database’. Thank you!