The CSV Line Loop action allows you to loop through a CSV file in the current Record and run actions for each line

NOTE: Loop actions are available in the Enterprise Edition only. 


Actions

Add the actions you wish to process for each Line Item into the Actions list. 


* Here are some things to keep in mind:

  • You can use the [LINECTR] variable in your actions to get the line number being processed
  • You can use the [CSV:columnname] variable syntax to get the CSV data for the current line. Where "columname" is the name of the column header for he column you wish to get data.
  • You can use the [CSVAN:columnname] variable syntax to get the CSV data for the current line. This version will remove all non-alpha-numeric and non-space characters from the header column name so headers with parentheses or brackets will still work in the variable replacement. 



[CSV:name], [CSVAN:name] Examples:


Example CSV file:

Name,Address,City,State,Zip,Phone (10 chars)

Smith,123 Maple,Anytown,XX,00000,8889991111

Jones,3435 No Street,Anothertown,YY,11111,6665554444


In the above example, you could use the following variables in your actions to retrieve the data for row 1.


[CSV:Name] = Jones

[CSVAN:Name] = Jones


[CSV:Address] = 123 Maple

[CSVAN:Address] = 123 Maple


[CSV:Phone (10 chars)] = 10 chars

[CSVAN:Phone 10 chars] = 8889991111


Notice that [CSV:Phone (10 chars)] will return "10 chars". Although the data dictionary contains 8889991111 for that column, the parentheses will interfere with the variable replacement. It will look to the variable replacement engine like you are trying to use a variable named [CSV:Phone ()] with a value of "10 chars" sent into it. Since there is no variable named [CSV:Phone ()] it will just return the value that was inside of it. CSVAN removes everything that is not alpha-numeric or spaces from the column name so you can retrieve the column value using [CSVAN:Phone 10 chars]. Notice the header name we used has to be "Phone (10 chars)" with the non-alphanumeric/non-space characters removed.


TIP: If you get into a pinch, you can try using the [FIELDLIKE()] variable to get column values. In the above example, [FIELDLIKE(CSV:Phone*)] would also work. The * represents a wildcard and the variable will return the first value that matches the given pattern.