AX1127
Importing data to the database from an Axiom form
You can configure an Axiom form so that users are prompted to upload a data file, then an import utility is executed to import the uploaded data into the database.
NOTE: If you want to execute a data import that does not require a file upload, then you should use the RunEvent command instead. Using RunEvent, you can trigger a Scheduler job for execution, where the Scheduler job runs the desired import.
Requirements and limitations
-
The form must contain a Button component that uses the Import Data File button behavior. This behavior is only supported for use on the Button component; it is not supported on Button tags for Formatted Grid components.
-
An import utility must be defined in the system to facilitate the data import. This import is then referenced in the Button component properties. The import must be configured as follows:
- The Import source must be an Excel file or a delimited file.
- The File Location must be set to Prompt for file during execution.
The import must otherwise be configured as normal to import data from the expected file structure.
-
The file uploaded by the user must conform to the expected file structure of the import.
Setting up a Button component to import data
To allow users to import data from an uploaded document, add a Button component to the Axiom form canvas, and then configure the button as follows:
-
Set the Button Behavior to Import Data File.
-
For Import Package, specify the import utility to execute after the data file has been uploaded. Use the [...] button to select the import from the Imports Library. Once an import has been selected, the file path is listed in the Import Package field.
NOTE: Axiom Software does not restrict the import utility selection to imports that meet the requirements for this button behavior. If you select an import that does not meet these requirements—for example, an import that uses a database source instead of a data file—the import will still be executed by the button, but the user experience will not make any sense because the user will still be prompted to upload a file first. The Import Data File button behavior is only intended to handle imports that use an uploaded data file.
Example Button component configured to import data
You can configure the other general button properties as desired. For example, the button text should be set to something like "Upload Data File".
Import Data File behavior
Within the Axiom form, the user can click the button configured with the Import Data File button behavior in order to import data. The import occurs as follows:
-
The user is prompted to select a file for upload. This prompt is handled by the browser, so the exact behavior depends on the browser being used. The user must select a valid file type for the specified import: XLSX, CSV, or TXT.
-
The selected file is uploaded to the Axiom Application Server, where it is staged for use in the import utility. The file size must be less than 100MB, or else an upload error will occur and the import process is aborted.
-
The specified import utility is executed. Assuming that the import utility is configured to Prompt for file during execution, then the import utility uses the uploaded file for the import. (If the import utility has a specified file location, or if the import source for the utility is a database instead of a file type, then the import is still executed but the user's uploaded file is ignored. This is not the intended use case for the button behavior.)
-
When the import is complete, a success or failure message is presented in the browser. The user's uploaded file is also deleted from the application server.
If import errors occur, the message presented to the user does not provide the same level of detail as when running the import utility directly. If the error resolution is not obvious, you may need to execute the import utility in the Desktop Client with the same file that the user attempted to use, in order to view the detailed error message.
-
After the user dismisses the success or failure message for the import, a full form update is triggered. If the form is set up to query data from the target table for the import, the imported data should now be available.