CSV imports and exports can be performed on tables through the user interface using the Actions menu in the workspace.
Both imports and exports are performed in the context of a dataset.
Imports and exports can also be done programmatically.
Default import and export option values can be set in the Administration area, under User interface > Graphical interface configuration > Default option values > Import/Export.
When exporting to CSV, if the table has filters applied, only the records that correspond to the filter are included in the exported file.
The CSV export options are as follows:
Download file name | Specifies the name of the CSV file to be exported. This field is pre-populated with the name of the table from which the records are being exported. |
File encoding | Specifies the character encoding to use for the exported file. The default is UTF-8. |
Enable inheritance | In order to consider the inheritance during a CSV export, the option has to be defined in the model. For more information on inheritance, see Inheritance and value resolution. Specifies if inheritance will be taken into account during a CSV export. If inheritance is enabled, resolved values of fields are exported with the technical data that define the possible inheritance mode of the record or the field. If inheritance is disabled, resolved values of fields are exported and occulted records are ignored. By default, this option is disabled. Note: Inheritance is always ignored, if the table dataset has no parent or if the table has no inherited field. |
User-friendly mode | Specifies whether exported values will be represented in a user-friendly way, or in a raw format. For example, in user-friendly mode, dates and numbers are formatted according to the user's locale, and foreign keys and enumerated values display their associated labels. Note: If this option is selected, the exported file will not be able to be re-imported. |
Include technical data | Specifies whether internal technical data will be included in the export. Note: If this option is selected, the exported file will not be able to be re-imported. |
Column header | Specifies whether or not to include column headers in the CSV file.
|
Field separator | Specifies the field separator to use for exports. The default separator is comma, it can be modified under Administration > User interface. |
List separator | Specifies the separator to use for values lists. The default separator is line return, it can be modified under Administration > User interface. |
Programmatic CSV exports are performed using the classes
and ExportSpec
in the Java API.ExportImportCSVSpec
Download file name | Specifies the name of the CSV file to be imported. |
Import mode | When importing a CSV file, you must specify one of the following import modes, which will control the integrity of operations between the source and the target table.
|
File encoding | Specifies the character encoding to use for the exported file. The default is UTF-8. |
Enable inheritance | In order to consider the inheritance during a CSV import, the option has to be defined in the model. For more information on inheritance, see Inheritance and value resolution and Specifies whether the inheritance will be taken into account during a CSV import. If technical data in the CSV file define an inherit mode, corresponding fields or records are forced to be inherited. If technical data define an occult mode, corresponding records are forced to be occulted. Otherwise, fields are overwritten with values read from the CSV file. By default, this option is disabled. Note: Inheritance is always ignored if the dataset of the table has no parent or if the table has no inherited field. |
Column header | Specifies whether or not to include column headers in the CSV file.
|
Field separator | Specifies the field separator to use for exports. The default separator is comma, it can be modified under Administration > User interface. |
List separator | Specifies the separator to use for values lists. The default separator is line return, it can be modified under Administration > User interface. |
Programmatic CSV imports are performed using the classes
and ImportSpec
in the Java API.ExportImportCSVSpec
The CSV import and export services support multi-valued fields, namely aggregated lists. This is only supported for simple typed lists, such as lists of string
, date
, or int
, and for foreign keys. If a table reference is linked to a composite primary key, each item in the list is a formatted string, for example, "true|99". Aggregated lists of groups are not exported.
At export, the items in the list are separated using line separators. In cases where the exported field already contains a line separator, for example in an osd:html
or an osd:text
, the code _crnl_
is inserted in place of the field value's line separators. The same formatting is expected at import, with the whole field value surrounded by quotes.
Hidden fields are exported as ebx-csv:hidden
strings. An imported hidden string will not modify a field's content.
Using CSV import and export services, a string with a value set to null
is exported as an empty string. Therefore, a round trip export-import procedure will end up replacing null
string values with empty strings.
Using programmatic services, the specific value ebx-csv:nil
can be assigned to strings with values set to null
. If this is done, the null
string values will not be replaced by empty strings during round trip export-import procedures. See ExportImportCSVSpec.setNullStringEncoded
in the Java API for more information.
The following date and time formats are supported:
Type | Format | Example |
---|---|---|
xs:date | yyyy-MM-dd | 2007-12-31 |
xs:time | HH:mm:ss or HH:mm:ss.SSS | 11:55:00 |
xs:dateTime | yyyy-MM-ddTHH:mm:ss or yyyy-MM-ddTHH:mm:ss.SSS | 2007-12-31T11:55:00 |
The CSV import and export services do not support multi-valued groups, that is, aggregated lists of complex type elements. Exporting such nodes will not cause any error, however, no value will be exported.
In a CSV file, it is impossible to differentiate a created terminal group that contains only empty fields from a non-created one.
As a consequence, some differences may appear during comparison after performing an export followed by an import. To ensure the symmetry of import and export, use XML import and export instead. See XML import and export.
If two columns share the same label header, an export of the table can be performed successfully, but exported data cannot later be re-imported.
The CSV import and export services do not support association values, i.e. the associated records.
Exporting such fields will not cause any error, however, no value will be exported.
Importing such fields will cause an error and the import procedure will be aborted.
The CSV import and export services do not support selection values, i.e. the selected records.
Exporting such fields will not cause any error, however, no value will be exported.
Importing such fields will cause an error and the import procedure will be aborted.