4.39. import

4.39.1. Summary

Parameters: table type

Positional parameters in same order.

The attribute hash reference is passed after the parameters but before the container text argument. This may mean that there are parameters not shown here.

Interpolates container text by default.

This is a container tag, i.e. [import] FOO [/import]. Nesting: NO

Invalidates cache: YES

Called Routine:

ASP-like Perl call:

    $Tag->import(
        {
         table => VALUE,
         type => VALUE,
        },
        BODY
    )

 OR

    $Tag->import($table, $type, $ATTRHASH, $BODY);

Attribute aliases

            base ==> table
            database ==> table
    [import table type other_named_attributes]
Parameters Description Default
base Alias for table DEFAULT_VALUE
database Alias for table DEFAULT_VALUE
table   DEFAULT_VALUE
type   DEFAULT_VALUE
Attributes Default
interpolate No
reparse Yes
Other_Characteristics  
Invalidates cache YES
Container tag Yes
Has Subtags No
Nests No

Tag expansion example:

    [import table type]
---
    TODO: (tag result)

ASP-like Perl call:

   $Tag->import(  { table => VALUE_table
                     type => VALUE_type
}, $body  );

or similarly with positional parameters,

    $Tag->import(table,type, $attribute_hash_reference, $body);

4.39.2. Description

Named attributes:

    [import table=table_name
            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 defined by the setting of the database DELIMITER. The table must already be a defined Interchange database table; it cannot be created on the fly. (If you need that, it is time to use SQL.)

The type of LINE and continue setting of NOTES is particularly useful, for it allows you to name your fields and not have to remember the order in which they appear 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 you do not use NOTES mode, you must import the fields in the same order as they appear in the ASCII source file.

The [import ....] TEXT [/import] region may contain multiple records. If using NOTES mode, you must use a separator, which by default is a form-feed character (^L).

4.39.2.1. table

4.39.2.2. type