Please enable JavaScript to view this site.

Altova MapForce 2021 Enterprise Edition

The mapping illustrated below reads data from an image file and writes it to a database table. The target database is SQLite. Notice that the data type of the picture database field is BLOB.

mf-func-read-binary-file-example1

To extract binary content from the file, the read-binary-file function was used. In this example, the first argument, filepath, is supplied by a constant. Note that, because the path is relative, MapForce will look for the image file in the same directory as the mapping.

 

The mapping populates the following fields in the target database:

 

id - In this example, the database component is configured so that id is database-generated rather than being supplied by the mapping. For more information, see Inserting Data into a Table.

mf-func-read-binary-file-example2

title -  This value is provided by a simple input component with the same name. Note that a design-time execution value is set ("product1") in order to make it possible to preview the mapping. For more information, see Supplying Parameters to the Mapping.

mf-func-read-binary-file-example3

picture - This field receives the direct output of the read-binary-file function.

 

Because the target component is a database, previewing the mapping generates a pseudo-SQL script that you can review, but does not send any changes to the database. To run the actual script against the database, select the menu command Output | Run SQL-Script.

© 2020 Altova GmbH