Import Data
Description
It can be useful to export and download data from an application and then upload that data at a later time. The Import Data part allows you to import into your application data that was exported using an XML or CSV file.
Editor Fields
The Import Data part has the following editor fields.
Field Name |
Description |
Type |
Optional/Mandatory |
Use File Upload |
Select this option to show the Select File and Upload buttons on the screen, allowing the user to choose a file to import. |
Checkbox |
Optional |
Caption |
The caption field is not used. |
Text |
Optional |
File type |
These are the file extensions of the files to be uploaded. |
Options |
Mandatory |
Mode |
Currently, the system supports overwrite mode. |
Overwrite |
Optional |
Table Name |
This is the name of the table to update. If you leave this field blank the system will use the name of the file uploaded. |
Text |
Optional |
Custom label |
This is the upload label. If you leave this field empty the system will use Select a file.... |
Text |
Optional |
Custom button caption |
This is the caption the system displays on the upload button. If you leave this field empty the system uses Upload as the button caption. |
Text |
Optional |
Special Notes
- Table Name – The name of the table is taken over from the filename or the tablename attribute value when using XML. But when the table name is specified in the part configuration, the system will use the specified name. The name must exactly match the name in the resources/project, e.g. the system will not import filenames with a copy indication like [Thesaurus (1).csv] or different casing like [thesaurus.txt] (if the target table is named [Thesaurus]).
- Existing Table – The table into which to import the data must already exist.
- Full Overwrite – The import function has been designed to fully overwrite the content to prevent possible changes or conflicts for the autonumber/identity column.
- Empty File – If you upload an empty file, the system will erase all data from the table.
- Full Table Rollback – If the system detects a problem with a file, or if it cannot import a record, the system will roll back the entire import.
- Empty Fields – There are several ways to define if a field should be empty or a NULL value. When importing text based files (comma, tab, semi-colon), the literal (case sensitive) value ‘eMPTyVaLue’ will be considered to be an ‘empty string’. The value “” or “NuLLeD” will be considered a NULL value/not existing value for the table. For XML the indication can be made more explicit with the attribute xsi:nil="true", in that case the cell value will be set to NULL. But the ‘eMPTyVaLue’ and ‘NuLLeD’ values will also work like the regular text file import.
- Escaping XML – Not all characters are allowed in XML, as they could break the XML structure. The following characters are expected to be escaped:
\nas
<as<
>as>
&as&
"as" - Carriage Return in XML – Beware of using explicit or implicit carriage returns in the XML documents, as they can break display of values in the designer table editor. Always use to indicate a new line.
- CSV/TXT/XLS – When using text import files (comma, tab, semi-colon), it is suggested you wrap all values in double quotes “. This is always needed when the value itself contains a “ or new lines/carriage returns.
- Escaping CSV/TXT/XLS – Because of the wrapping of the values with double quotes, possible double quotes in the value itself must be escaped by adding an additional double quote. For example, the value: [Example ”quote escaping”] must be written as ”Example ””quote escaping”””.
- CSV/TXT/XLS Column Names – When using text import files, the first line must contain the column names. The column names must be in the same order of the columns of the table, all columns must be present and the names of the columns must be an exact match (but not case sensitive).
- XML and Column Names – The XML file does not explicitly need the list of columns to be used, but it is recommended to do so as that will make the record content more flexible. When the column names are not explicitly defined, the engine will try to determine the column names and order using the first record. But that means that the first record must contain all columns.
- XML Column Order – The order of the columns is determined by the index attribute; this allows some flexibility in handling column orders. The fields of the actual records are looked up by name, so the order in which they are specified in the record nodes does not matter.
- XML Column Name Case Sensitive – The names of the columns in the columns node must match case sensitive with the names in the record nodes.
- XML Missing Columns in Records – When a column is missing in a record, it is implicitly assumed to be NULL.
- Implicit Column Types – The column types are not explicitly defined. All fields are considered ‘text’ and it is left to the database column definition if conversion takes place.