4D v13.4

File formats

Home

 
4D v13.4
File formats

File formats  


 

 

The file format describes the way in which fields and records are arranged in the import or export file. Some file formats also include formatting information. 4D supports several file formats and provides several internal formatting options as well. 

Here is a description of the different formats that 4D supports for importing and exporting data.

Text  

This format separates fields within a record with the end-of-field delimiter and records with the end-of-record delimiter. The record delimiter depends on the destination platform: Carriage return/Line return for Windows and Carriage return for Mac OS.
This format is not associated with a specific character set; you can choose the one that suits you from the "Character Set" menu (UTF-8 by default) or using the USE CHARACTER SET command. UTF-16 is not supported.

When exporting data, 4D writes a Byte Order Mask (BOM) if the character set is UTF-8. When 4D detects a BOM while importing data, the character set specified by this BOM takes priority.

The Fixed Length Text format allocates a specific number of characters per field. No end-of-field delimiter is used. All records have the same number of characters even if a the record’s values can fit into fewer characters. When this happens, a fill character — usually a space — is used to pad fields. You can specify the fill character for each data type or use default characters (see Filling page). However, if a value has more characters than the number of characters allocated to the field, the value will be truncated.

When importing data, 4D removes any fill characters at the end of each string.

The other characteristics of this format are the same as the Text format.

DIFF  

This stands for Data Interchange Format. DIF is a standard format that, as a rule, uses the "IBM437" character set, which is sometimes called "Latin-US (DOS)" (supported by the CONVERT FROM TEXT and Convert to text commands). When you select this format, 4D does not use any current import/export filters set using the USE CHARACTER SET command.

The choice of destination platform determines only the record delimiters: Carriage return/line return for Windows and Carriage return for Mac OS.

In the DIF fomat, character strings cannot contain carriage returns (character codes 10 or 13). 4D replaces them by spaces during the export. In addition, the quotation mark " is used as the internal delimiter. Any quotation marks found in strings to be exported are "escaped" by doubling the character ("").
For example, Monday\rTuesday"Wednesday" will be exported in DIF as "Monday Tuesday""Wednesday""" 

When importing data, 4D removes any fill characters found at the end of strings.

DBF  

This name is used for the “dBase” format. dBase is a file format commonly used in DOS and Windows database applications.

4D generally processes this file format in the same way it does the DIFF format.

Note that in the DBF format, strings are exported as a fixed size with fill characters (either ' ' or '0' depending on the type of data). When importing data, 4D removes any fill characters found at the end of strings.

SYLK  

This stands for SYmbolic LinK format.

This format is not associated with any specific chaaracter set; you can choose the one that suits your needs in the Character Set menu (by default UTF-8) or using the USE CHARACTER SET command. There is no handling of Byte Order Masks. L'UTF-16 is not supported.

The record delimiter depends on the destination platform: Carriage return/Line return for Windows and Carriage return for Mac OS.

Any carriage returns (character code 13) found in the exported strings are "escaped" as follows: <escape><blank>: under Windows and <escape><blank>= under Mac OS.

Note: The 4D View plug-in also supports the use of the SYLK format for importing and exporting.

This format, which is specific to 4D, makes it easy to exchange records between different 4D databases. This format supports all of 4D’s data types, including Picture and Blob. The 4D export file extension is “.4IE.”

When this format is selected, you can no longer choose a destination platform. You also cannot choose a specific character set (Unicode is always used) and any import/export filters installed using the USE CHARACTER SET command are ignored.

XML  

XML (eXtensible Markup Language) is a data exchange standard. This language is based on the use of tags that enable precise description of the exchanged data as well as its structure. XML files are Text format files; their content is parsed by the applications importing the data. Many applications support this format. For more information about XML terminology, refer to XML in the 4D Language Reference manual.

This format is not associated with any specific character set; you can set one in the export dialog box. It is specified in the XML document itself. Any import/export character set set using the USE CHARACTER SET command is ignored.

The record delimiter depends on the destination platform: Carriage return/Line return for Windows and Carriage return for Mac OS.

The following options are available for each imported or exported file format.

The Character Set menu is available for Text, SYLK and XML (export) file formats. It contains a list of standard character sets as specific by the IANA (for more information, refer to: http://www.iana.org/assignments/character-sets). 

Note: The Character Set menu is locked to the "IBM437" character set for the DIFF and DBF formats and this menu is not available for the 4D format.

  • When exporting, you use this menu to specify the encoding for the exported data.
  • When importing, you use this menu to specify the encoding of the imported data. This menu is disabled if the header of the export files includes a BOM (see Header page) because the encoding of the imported data is automatically predefined in this case.
    The default encoding for import and export operations is UTF-8 or the character set specified by the USE CHARACTER SET command (if it has been executed). Note that selecting an encoding in the import or export dialog box does not modify the current character set of the application.

You use this menu to predefine the Field, record, and file delimiters. The following options are available:

  • Automatic: end of record value set according to current platform.
  • Macintosh: end of field = Tab, end of record = Carriage return, end of file = <None>
  • Windows: end of field = Tab, end of record = Carriage return+Line return, end of file = <None>
  • Unix: end of record = Line return
  • Custom: displays the Delimiters page.

 
PROPERTIES 

Product: 4D
Theme: Exporting and importing data