Editing Page: Overview
The Editing Page will display the book to be edited (the book that was clicked on the main page). Book details can be edited and the changes saved back to the DB. The screenshots below show the page design (left) and the page in a simulation (right).
An important part of the design of this page is to restrict the display to only show the book that was selected for editing. A convenient way to do this is to configure the \$EditBook page source to select only the book we want. This way, after changes have been made, saving the page source will save the edited Author and Book record to the DB.
How to configure the page source to select only a single book record is explained below.
Editing Page has two page sources: \$PERSISTENT and \$EditBook (see screenshot below).
The \$PERSISTENT tree is the same that was created for Main Page.
The \$EditBook page source tree selects the Book record and related Author record to edit. Configure the page source as follows:
1.When you add the page source, add it as a DB structure and select the BookCatalog.sqlite database as the data source.
2.Since we want to select the author as the parent of the book, select the Authors table as the table to add and click Build a SELECT Statement.
3.In the next dialog (screenshot below left), add a WHERE expression to select the author that has an ID which is the same as that stored in the EditAuthorID element of the \$PERSISTENT tree. Then click Add related tables.
4.In the Add/Edit Relations dialog that appears (screenshot below right), select the Books table, which is hierarchically linked to Authors via its foreign-key column AuthorID.
5.Click the table's Filter icon to select only that book which has a Book_ID element which is the same as that stored in the EditBookID element of the \$PERSISTENT tree. Without this filter, all books of the selected author will be displayed.
6.Make sure that the Load Data on Every Page property of the page source has been set.
When the subpage is opened, it will display the author that has an ID matching the ID in \$PERSISTENT/Root/EditAuthorID and the book that has an ID matching the ID in \$PERSISTENT/Root/EditBookID. The details of this author and this book can now be displayed in Editing Page and edited (see the next topic, Editing Page: Edit Text and Image Data).