Especially in SQL databases, there are certain things that can be set with additional database attributes. For text import, the CONTINUE extended database import attribute allows additional control over the format of imported text.
NOTE: CONTINUE applies to all types except CSV. (You won't want to use NOTES unless using type LINE.)
\
) at the end of a record, just like many Unix commands and shells.
DITTO is invoked when the key field is blank -- it adds the contents of following fields to the one above, separated by a newline character. This allows additional text to be added to a field beyond the 255 characters available with most spreadsheets and flat-file databases.
Example in catalog.cfg:
Database products products.txt TAB Database products CONTINUE DITTO
Products.asc file:
code price description 00-0011 500000 The Mona Lisa, one of the worlds great masterpieces. Now at a reduced price!
The description for product 00-0011 will contain the contents of the description field on both lines, separated by a newline.
NOTE: Fields are separated by tabs, formatted for reading convenience.
This will work for multiple fields in the same record. If the field contains any non-empty value, it will be appended.
LINE is a special setting so that you can use a multi-line field. Normally, when using the LINE type, you may have only data on one line separated by one blank line. When using CONTINUE LINE, you may have some number of fields which are each on a line, while the last one spans multiple lines up until the first blank line.
Example in catalog.cfg:
Database products products.txt LINE Database products CONTINUE LINE
Products.asc file:
code price description 00-0011 500000 The Mona Lisa, one of the worlds great masterpieces. Now at a reduced price! 00-0011a 1000 A special frame for the Mona Lisa.
NOTES reads a Lotus Notes ``structured text'' file. The format is that there are any number of fields, all except one of which must have a field name followed by a colon and then the data. There is optional whitespace after the colon.
Records are separated by a settable delimiting charater which goes on a line by itself, much like a ``here document''. By default it is a form feed (^L) character.
The final field begins at the first blank line and continues to the end of
the record. This final field is named notes_field
unless you set it as mentioned below.
MiniVend reads the field names from the first paragraph of the file. The
key field should be first, followed by other fields in any order. If one
(and only one) field name has whitespace, then its name is used for the notes_field
and any characters after a space or
TAB are used as the record delimiter. If there are none, then the delimiter returns to the default form feed
(^L) and the field name reverts to
notes_field
. The field in question will be discarded, but a second field with
whitespace will cause an import error.
Following records are then read by name, and only fields with data in them
need be set. Only the notes_field
may contain a newline. It is always the last field in the record, and
begins at the first blank line.
The following example sets the delimiter to a tilde (~)
and renames the notes_field
to description.
Example in catalog.cfg:
Database products products.txt LINE Database products CONTINUE NOTES
Products.asc file:
code title price image description ~ size color title: Mona Lisa price: 500000 code: 00-0011 image: 00-0011.jpg The Mona Lisa, one of the worlds great masterpieces. Now at a reduced price! ~ title: The Art Store T-Shirt code: 99-102 size: Medium, Large*, XL=Extra Large color: Green, Blue, Red, White*, Black price: 2000 Extra large 1.00 extra. ~
Set the EXCEL attribute to 1 to fix these problems on import:
Database products EXCEL 1
This is normally used only with TAB-delimited files.