1.12. Importing in a Page
To add a data record to a database as a result of an order or other operation, use Interchange's [import ...] tag.
[import table type*] RECORD [/import]
[import table=table_name file=filename* type=(TAB|PIPE|CSV|%%|LINE)* continue=(NOTES|UNIX|DITTO)* separator=c*]
Import one or more records into a database. The type is any of the valid Interchange delimiter types, with the default being TAB. The table must already be a defined Interchange database table. It cannot be created on-the-fly. If on-the-fly functionality is need, it is time to use SQL.
The import type selected need not match the type the database was specified. Different delimiters may be used.
The type of LINE and continue setting of NOTES is particularly useful, for it allows fields to be named and not have to be in any particular order of appearance in the database. The following two imports are identical in effect:
[import table=orders] code: [value mv_order_number] shipping_mode: [shipping-description] status: pending [/import] [import table=orders] shipping_mode: [shipping-description] status: pending code: [value mv_order_number] [/import]
The code or key must always be present, and is always named code. If NOTES mode is not used, the fields must be imported in the same order as they appear in the ASCII source file.
The file option overrides the container text and imports directly from a named file based in the catalog directory. To import from products.txt, specify file="products/products.txt". If the NoAbsolute directive is set to Yes in interchange.cfg, only relative path names will be allowed.
The [import ....] TEXT [/import] region may contain multiple records. If using NOTES mode, a separator must be used, which, by default, is a form-feed character (^L). See Import Attributes for more information.