Related Information Examples & Tutorials

Dynamic CSV Import Indexing

This powerful feature in the Import/Export module enables you to read CSV data input files more flexibly. You can easily parse complex CSV data files, pulling data from only the columns you need, without having to specify skipped columns in your CSV import map. You can also quickly change a previously created import map to pull data from different columns, without having to create a new map. Columns can be read more than once in each pass, if needed.

tip.gif Dynamic CSV Import Indexing is very useful for processing returns from skip tracing, for instance, where you may receive a CSV with 150 columns or more. You can easily and simply just pick out only the columns you want to import.

CSV column indexing is activated through the Note field in the import map's Field Specification. The first symbol must be an @ to activate "Dynamic CSV Mode." When Collect! detects the @ symbol in the Note field, it uses Dynamic CSV Import Indexing to parse the values in the field.

The first symbol must be an @ to activate "Dynamic CSV Mode".


Dynamic CSV Import Indexing

@[alpha] or @[numeric] indicates a column in the CSV that you want Collect! to parse for data to import into the Field you have specified. In the example above, the value in the A column will be put into the Client Number field.

The # symbol indicates the start position of a comment. Everything past the # symbol is ignored. This enables you to continue to use the Note field to give the user a description of the data coming into the specified field.

tip.gif You can pull data from any column in any order. Also, any column can be read more than once in a single pass, if needed.


Pulling Data from Different Columns

tip.gif Collect! also recognizes numeric column "counting" so you could say @0 for the first column. Notice that the numeric count starts with ZERO, not the number ONE.

@[space] does not result in any output but allows the user to enter static data prior to the data being imported.


Inserting Static Data Prior to Column Data

You can also use Dynamic CSV Import Indexing for only one or a few fields in your map while letting Collect! parse the other columns in the traditional way.


Traditional Parsing with One Dynamic Specification

Traditionally, Collect! reads each column once, starting from the first and proceeding to the last. With Dynamic CSV Import Indexing, you can jump to another column, out of order, anywhere in your traditional import map. This is useful when your client sends you a new file where the order of one or more columns has changed. You don't have to build a new import map from scratch.

The @[>] symbol instructs the CSV parser to advance to the next CSV column after processing this Dynamic CSV field.


Forcing Collect! to Read the Next CSV Column

tip.gif Since Dynamic CSV fields can pull data from any column, not just the underlying current one, Collect! does not advance to the next CSV column by default. To force it to advance, put @> anywhere in the format string. Then Collect! will carry on parsing your data, in the traditional way, until it encounters another Dynamic CSV specification, if there is one.

An error is written to the IMPORT log if an attempt is made to index past the end of the CSV line. If "Debug" and " Verbose" are enabled in Screen and Messages, an error message box will pop up.

Summary

Dynamic CSV Import Indexing enables you to import complex CSV data files in an easy and simple way. You no longer need to create maps with many skipped columns. You can easily change a map when a client provides a data file with reordered columns that no longer match the map you made previously for them. You can easily create maps for several different sources where the data is being sent to you with different column orders Columns can be read more than once in each pass, if needed.

CSV column indexing is activated through the Note filled in the import map's Field Specification. Several simple symbols are used with the @ symbol to control Dynamic CSV parsing.

Top of page.

See Also

- Import/Export Topics

Top of page.

Was this page helpful? Do you have any comments on this document? Can we make it better? If so how may we improve this page.

Please click this link to send us your comments: helpinfo@collect.org