File Heater, import/export files
The File Heater is used to import files (binary files, pictures, images, Word and PDF documents…) of all kinds into databases and/or export them. This Heater will greatly simplify the import/export of files. After dragging and dropping the Heater onto the Designer page, you have to specify whether a file is to be read (imported) or written (exported).
The following input parameters are expected:
Importing files: data orientation = READ
- First input parameter = filename of a file in your local environment .
Exporting files: data orientation = WRITE
- First input parameter = filename of a file to be written to your local environment.
- Second input parameter = the actual data field that will be written.
Settings when importing files:
In order to be able to import files into databases, you have to select the Data orientation option to READ = read files from your local environment.
In this case, the one and only input parameter is the filename of a file on a local or network drive. The output of the Heater makes the data contained in the file available for assignment or processing. Note: In the READ (import) mode the File Heater also supports HTTP URL file paths.
With the option “Use a specific Read/Write directory” you can enter a local path to override any path information specified in the filename parameter. The path information of the input parameter is thereby ignored and the path specified here is used instead.
Read/Write data type: This informs FlowHeater how to interpret the file. In Binary mode the file is read exactly as it is in the storage medium (default setting). If you wish to read the data as plain text instead (data type = Text) you can also select the Codepage to comply with the data. FlowHeater will then interpret the file so that special symbols are correctly converted for storage in the database.
Output data type: In Binary mode only RAW is available here. However, if you select Text instead of Binary mode then an alternative data type of STRING may be chosen.
The output data type RAW is suitable when importing a file into a database field of types: binary, varbinary, image or blob.
Conversely, an output data type of STRING should be used when importing the contents of a text file into a database field of types: char, nchar, varchar, nvarchar, text, ntext or memo.
Settings when exporting files:
In order to be able to export files from within database fields you have to set the File Heater data orientation to WRITE = write data to a local environment.
In this case, the first input parameter is the filename of the file that is to be written to a local or network drive. The second parameter delivers the actual data to the Heater that is to be written to the file.
Please note that in this case, the Heater has no output parameter.
With the option “Use a specific Read/Write directory” you can enter a local path to override any path information specified in the filename parameter with a fixed path. The path information of the input parameter is thereby ignored and the path specified here is used instead.
Read/Write data type: This informs FlowHeater what kind of file is to be written. In Binary mode the file is written exactly as it is in the storage medium (default setting). If you wish to write the data as plain text instead (data type = Text) you can also select the Codepage to format the data with. FlowHeater will then write special symbols to the file with the relevant encoding.
Overwrite an existing file: Checking this option permits replacement of an existing file with the same filename given in the input parameter.
Append: When this option is checked, data is appended to the end of an existing file. If no file already exists, then a new file is created. This is option is not available in Binary mode.
Append a line break: If this option is checked, before any data is appended to an existing file, a line break is inserted first. This option is not available in Binary mode.
Please also refer to the general information on the use of Heaters (functions)