Hierarchical Database
This tutorial describes key features of a design based on a hierarchical DB. The SQLite DB we use is a catalog of books that has two tables: Authors and Books. In the database, the Books table has a foreign key that relates it to an Author.
We would like our design to do the following (see screenshot below):
•Display each author in the DB, together with information about all the author's books. For example, you will see in the screenshot that Agatha Christie is listed with information about her (from the Authors table) and information about her two books in the catalog (from the Books table).
•Filter the catalog according to genre
•Edit book and author information
•Add new books to the DB
•Search the DB and filter the catalog to show books that contain the search string in any of its fields
The tutorial files
The files for this tutorial are located in your (My) Documents MobileTogether folder: MobileTogetherDesignerExamples\Tutorials\Databases.
•The design file: BookCatalog.mtd
•The SQLite database that contains the book records: BookCatalog.sqlite
You can open the design file in MobileTogether Designer and run simulations in MobileTogether Designer. This tutorial assumes that you know how to work with controls and actions. It does not go step-by-step through the process of building the design, but, for each design feature, discusses the strategy behind its implementation.
Tutorial structure
This tutorial is organized into the following sections:
•Hierarchical DB Structure explains the idea of hierarchical DBs and how they are used in MobileTogether
•Pages and Page Sources describe the pages of the tutorial
•Main Page: Select Book to Edit
•Editing Page: Edit Text and Image Data
Video demos of how to build a DB-based app
The Altova website provides the following video demos that show how to build a DB-based app:
•Building a database-driven app: How to connect to a DB and query it, how to retrieve DB records, and how to present DB data in the form of tables
•Working with databases, Part 2: Adds the following functionality: how to query, view, and edit DB records
•Working with databases, Part 3: Lets users upload images, resize images, and save the edited images; plus, more use of tables and other controls
•Working with databases, Part 4: Adds functionality for record creation and deletion, and for data validation
•Working with databases, Part 5: Shows how to filter results without calls to the backend. Also: how to save XQuery functions for increased efficiency