The Switch DB action works for file-based database (SQLite or MS Access) and enables you to link a different database to a DB connection. In this way you can easily change the data of a DB page source. In the Switch DB action, you select the DB page source (data connection) for which you want to change the data, and then select the new data file. When the switch is made at run time, the affected page sources are reset. In MobileTogether Designer simulations, the reset page sources are listed in the Messages window.
Note the following points:
•The Switch DB feature works only with file-based DBs. Both the original and replacing databases must be either SQLite or MS Access, and they must match the data structure of the page source (data connection).
•The Switch DB action is compatible with MobileTogether Server Advanced Edition only, and not with the standard edition .
•In MobileTogether Designer, you cannot set a DB switch on a page source that has been set to Auto-load on first use. If you try to do this, then MobileTogether Designer will list the page source in the Messages window together with a link to it. You can click the link to quickly jump to the page source and change the Auto-load setting.
•If the client session times out or if the solution is suspended, the solution will restart with the switched data. To get back to the original data source in the course of the current workflow, you must add another DB Switch action that is set to the original database. A solution restart will, of course, start the solution with the original database.
The Connection Name setting is the name of a file-based DB page source. The combo box contains a list of connections to file-based DBs in the design.
The Database File setting is the path to the database that you want to switch to for the selected database connection. It should have a data structure that is the same as that of the selected page source.
The On Error option lets you define what should be done if an error occurs. Since the error handling can be precisely defined for this action, errors on such actions (that provide error handling) are treated as warnings—and not errors. The advantage is that you do not need to check errors on actions for which error handling has already been defined. The following error handling options are available:
•Abort Script: After an error occurs, all subsequent actions of the triggered event are terminated. This is the default action if an error occurs. If you wish to continue despite an error, select either the Continue or Throw option.
•Continue: Actions are not terminated. Instead, you can select what to do in either event: when there is no error (On Success), or when there is an error (On Error). For example, you might want to display a message box saying whether a page load was successful or not.
•Throw: If an error is detected, this option throws an exception that is stored in the Try/Catch action's variable. The Catch part of the Try/Catch action is used to specify what action to take if an error occurs. If no error occurs, then the next action is processed. See the section Try/Catch action for details.
MobileTogether extension functions
MobileTogether provides a range of XPath extension functions that have been specifically created for use in MobileTogether designs. Some functions can be particularly useful with specific actions. For example, mt-available-languages() returns the languages in which the solution is available and could, for example, be used with the Message Box action. If a function is especially relevant to this action, it is listed below. For a full list of extension functions and their descriptions, see the topic MobileTogether Extension Functions.