CSV Field Iterator

   

 

The CSV Field Iterator action allows you to easily iterate through the rows of any file where each line is a list of character-delimited fields (ie CSV comma-delimited files, tab-delimited files, etc.)

 

As each row in the file is iterated, field variables are set to the value of each field in that row.

 

For more information about iterator actions, see the Iterators topic. For some other actions that iterate over file contents, you may want to see the List Iterator, File Contents Iterator and XML Iterator actions.

 

 

CSVIterator

 

Example

 

The example above shows the iterator set up for a file, Simple.csv, whose contents look like this:

 

John Smith, 33 Pine Way, 555-2357

Albert Jones, 12 North St, 555-1234

Walter Dennis, 66 Ridge Cr, 555-9842

 

The first time the iterator is run, the variable Name will have the value "John Smith".  The second time the iterator runs, the variable Name will have the value "Albert Jones", etc.

 

The Address and Phone variables will be updated to reflect the Address and Phone fields for each row, as well.

 

Source File

 

Specify a file to iterate over.

 

 

Field Delimiter

 

By default, the iterator works with CSV (comma-delimited) files. However, you can use any delimiter character, or even a group of characters, to separate fields. The only limitation is that each row must be on a new line.

 

To use a "tab" character as the delimiter, specify \t.

 

 

Fields Are Quoted

 

Check this option if each field is quoted, ie "John Smith","33 Pine Way","555-2357".

 

 

Field Variables

 

This is where you specify the list of variables which are set on each iteration. The variables are set in order - ie the first variable is set to the field field, the second variable to the second field, etc, etc.

 

To add a new variable, select it from the combo box below the list and then click the "Add" button.

 

To move a variable up or down in the list, select it and then click the Up or Down button. To remove a variable, select it and click Remove.

 

 

At runtime, if there are more field variables to set than there are fields in a row, the extra variables will be cleared.

 

At runtime, if there are more fields in a row than there are field variables to set, the extra fields will be ignored.