Topics: |
How to: |
The Maintain Data product has been fully integrated into App Studio. The Maintain Data App icon, available in the Containers group of the Components tab, enables you to draw a Maintain Data container on the HTML canvas. The Containers group of the Components tab is shown in the following image.
When a Maintain Data file is added to an HTML page, it displays as a request in the Requests & Data Sources panel. Maintain Data requests display all functions, data sources, forms, variables, stacks, and parameters that are used in the Maintain Data file. If the Maintain Data request does not contain one of these components, it is not displayed beneath the request. A Maintain Data request in the Requests & Data Sources panel is shown in the following image.
You can create new functions, variables, and stacks, as well as add additional data sources and parameters by using the shortcut menu on the nodes. To edit a Maintain Data component, right-click the item and select Edit Source or Edit. The Edit Source option allows you to edit the entire Maintain Data file. The Edit option opens the Edit Function dialog box, where you can edit the signature and description of that function.
Many of the Maintain Data request components can be dragged to the canvas, or other panels, to automatically create the components and tasks needed to run the Maintain Data component. The following are examples of how you can drag Maintain Data components to a canvas.
When adding an existing Maintain Data file to your HTML page, you are prompted to run that Maintain Data file after the page is loaded. Clicking Yes (recommended) creates an action for the load task in the Tasks & Animations panel. This means that the Maintain Data file will connect once the HTML page is loaded. If you click No, no action is created for the load task.
The Maintain Data App container is created in the HTML canvas. This container enables you to construct the application front-end (or user interface). Then, you develop the code that extracts data from your data sources and updates the data sources with new data.
Your cursor turns into a crosshair.
Note:
You can create a Maintain Data application that can be used offline on a mobile device. When you create the Maintain Data application, use the Export for offline option to create an offline version of the file. The offline application can be accessed by a web browser on a mobile device, and saved to the device using the browser option to save to the Home screen. Users can then use the saved Maintain Data application offline. When they reconnect to the network and invoke the secured application, saved Maintain transactions are automatically submitted.
The Specify Name dialog box opens.
In the Properties panel for the DOCUMENT object, the new offline file is listed for the Offline: File property. Notice also that the Offline: Save on reconnect property is automatically enabled by default.
As an alternative to enabling the Offline: Save on reconnect property, you can use a JavaScript function to save updates offline and submit them upon reconnecting. Create a JavaScript event using the Events section of the Properties panel, or create a task in the Tasks & Animations panel that executes a JavaScript call, and set it execute the following function:
IbComposer_runOfflineRequests()
If the Offline: Save on reconnect property was set to Yes, any transactions saved will be submitted once an online connection is reestablished. If the Offline: Save on reconnect property was not set to Yes, then when you reconnect to the network, you must invoke the trigger to call the IbComposer_runOfflineRequests() function in order to submit your saved transactions.
Note: Offline applications must be non-persistent.
You can create a Maintain Data Application that uploads images to a BLOB field in a database. The application uses an edit box with a Type property of File to browse for images, which can then be saved to an application folder and then uploaded by executing a MODIFY procedure.
It should be configured to write to a BLOB field in your database using the file path of an image in an application folder. You can also use variables in a stack to assign an incremental ID number to each image for indexing.
A Browse button is added to the edit box.
An example of the syntax for this MODIFY procedure is shown below:
-SET &ECHO="ALL"; APP MAP PATHVAR C:/ibi/apps/APPNAME MODIFY FILE MASTER FREEFORM field1 field2 MATCH field1 ON MATCH REJECT ON NOMATCH INCLUDE DATA field1='&1', field2='&2', $ END -RUN
where:
Is a variable name that is also appended to the file name in the Maintain form as part of the image variable compute.
The APP MAP declaration sets PATHVAR as the path to the application folder containing the images.
Is the application folder to which the images are initially uploaded. This is the same location specified in the Copy file to property of the edit box on the HTML page.
The Master File associated with the database table to which the images are uploaded.
An index field used to identify the images in the table. For example, this could be an incremental ID number set using a compute in the Maintain form.
The BLOB field to which the images are added.
Are positional variables that pass the values of field1 and field2 to be written to the server. Values for field1 and field2 are passed together from the Maintain form to the MODIFY procedure.
The Open File dialog box opens.
Maintain Data requests are submitted from the Request & Data Sources panel. There are two basic types of requests to create new applications: Embedded and External. Both Embedded and External requests allow you to create applications manually, or using Update Assist. When you create a request manually, you design the forms, write the navigation and validation, and update the procedures using the Maintain Data Editor. Update Assist enables you to create simple applications and add, update, or delete records against any data source for which you have read/write access.
Note: The External Request shortcut menu also provides the Maintain data: Existing option, which imports a Maintain application created in the Maintain Development Environment (MDE).
The following steps walk you through the process of creating an Embedded request or External request manually. Also used to migrate existing Maintain procedures.
By default, for an Embedded request, Request1 is created.
For an External request, provide a name for your request in the Save As dialog box and click OK.
By default, Form1 has been created.
You can create an application using Update Assist that adds records, updates records, or deletes records against any data source for which you have read/write access. Data navigation and input validation are automatic. This means you get an update application with no need to design forms, or to write navigation, validation, or update procedures.
For more details on using Update Assist, see the WebFOCUS App Studio Maintain Data Getting Started content.
WebFOCUS | |
Feedback |