In this section: |
If you are running a Maintain Data application from a mobile device and you lose the wireless connection or connection to the Reporting Server, you can still save your data to the mobile device.
Maintain Data applications that can be asynchronous, must:
How to: |
For the example in this topic, a movie critic must rate movies. There may or may not be a connection to the Reporting Server when saving the review. The example uses the movies sample data source, as well as a second data source, called critic. Notice that the critic data source uses the same Moviecode and Title fields as the movies data source. While movies and critic are FOCUS files (SUFFIX=FOC), they could be SQL or any of the other supported data sources.
The components of this application reside in the repository.
The HTML/Document Wizard opens.
The Templates, Settings, and Themes dialog box opens.
By default, for an Embedded Request, Request1 is created.
This application uses the movies and critic data sources. A Maintain Data application can manipulate up to 15 data sources in a single application.
The Data Sources in Procedure dialog box should look similar to the following image.
The HTML canvas contains two tabs, as shown in the following image.
You can switch back and forth between the tabs.
When creating a non-persistent Maintain Data application, every time you return to the code, you have to start with Top case. This is because the agent on the Reporting Server goes away once the form is displayed. You need to create a variable, in this case, Action, to branch to the proper case every time.
The code has three cases: Top, Loadrecs, and Includer, as shown in the following image.
Movstk contains the list of movies that the critic needs to review. An HTML table is used to display and select the next movie to review.
Note: If you accidentally left-click Movstk and fields are created, click the undo icon, and make sure to right-click the stack before you drag it onto the form.
The HTML table is shown in the following image.
Note: By default, the edit box for Moviecode is named edit1 and the edit box for Title is named edit2.
The Action field determines where to branch when returning to your Maintain Data code. The Action field must be on the form, but does not need to be visible. You can select the field and the label and in the Properties panel make the objects not visible (Visible No).
All Maintain Data applications must have a Load task. The Load task launches the Maintain Data code and displays the forms. A persistent Maintain Data application can have multiple tasks that perform multiple cases. A non-persistent application only needs the Load task. This is because the Maintain Data code is always initiated from the Top case and why the Action field needs to be set in the JavaScript code.
While tasks can connect directly to the Maintain Data code, you use events to perform JavaScript.
Note: At runtime, when you select a row from the HTML table, the JavaScript has Moviecode populate the moviecode field and Title populate the title field.
You can select and review a movie, as shown in the following image.
Now that you have created the non-persistent application, you can make it so that it can work in an asynchronous environment.
If prompted to create the file, select Yes.
The first time you run the application, you must be connected to the Reporting Server. All of the components and data is loaded onto your mobile device.
You can run Asynch1 from your mobile device. If you are connected to the Reporting Server, the updates take place in real time. If you are not connected to the Reporting Server, the updates are saved to your mobile device. The next time you run the application while connected to the Reporting Server, all your changes are saved.