Altova MobileTogether Designer

Enter Data Offline and Upload

Home Prev Top Next

The example solution 01-AddRecord.mtd (start screen shown below) is located in the following (My) Documents folder: Altova\MobileTogetherDesigner9\MobileTogetherDesignerExamples\Tutorials\OfflineUsage. Open the file in MobileTogether Designer and run a simulation (F5) to see how it works.

 

The solution enables records to be entered on a client device, one record at a time, with each being saved to a SQLite database on the server, Addresses.sqlite, before the next record is entered. During editing, the record is stored in the $PERSISTENT page source on the client (see screenshot below). The solution's Server Access is restricted by the On Demand setting, as a result of which the solution will only communicate with the server when communication is required and is explicitly specified in the solution's workflow. Till such time, the solution is offline and the record's data is entered while the solution is offline. When the user clicks Upload to database now, the solution on the client connects with the server to upload the record to the SQLite database on the server.

Click to expand/collapse

 

Key settings

The key settings of the 01-AddRecord.mtd solution and for working offline are discussed below.

 

The Load Data setting

The Load Data setting is not applicable for this solution because the solution has only one page source, $PERSISTENT, which is on the client and for which, therefore, no data loading is required. (Since we want to display only the new record in the client—and not all the DB records—no other page source is needed to hold the records of the DB.)

 

The Save Data setting

The Save Data setting is not applicable to $PERSISTENT page sources.

 

The Server Access setting

The Server Access setting is set to On Demand. As a result the server is contacted only when the new record has to be uploaded to the server.

 

This happens when Upload to database now is clicked. This button's OnButtonClicked event triggers the following actions:

 

1.A DB Execute action that executes an SQL statement to insert the data of the $PERSISTENT tree as a new record on the server DB.

2.An Update Node action to reset the nodes of the $PERSISTENT tree, each to the empty string. This is required to enable data entry of the next record.

Click to expand/collapse

Note: In the design, click the Event Actions icon (circled in red in the screenshot above) to see how the actions for updating the database (described above) have been defined.

 

© 2018-2024 Altova GmbH