Message Image  

How to process tabular data using the CSV Parser node in App Connect

 View Only
Fri July 10, 2020 09:23 AM

Overview

It is very common for applications that work with tabular data to be able to export and import that data in the ‘CSV’ (Comma Separated Values) format. The CSV Parser node makes it really simple to process CSV data from one of the apps that you interact with; for example, Box and Dropbox. It does this by parsing the raw CSV data into App Connect flow context information that can then be used by any subsequent node in the App Connect flow.

The node is configured by supplying a small sample – a line or two – of the CSV data you want to parse. This allows the node to understand the structure of the data you want to process, and it means that all subsequent nodes in the flow can make use of that structure.

Resources

Using the CSV Parser node

You can use the CSV Parser node when you know that one of the previous nodes in your flow (or the flow API input) contains a string that contains CSV data. The next few sections go through the steps in using the CSV Parser node.

1. Find it

When you want to add a CSV Parser node to your flow, you can find it in the ‘Toolbox’ section.

2. Configure it

CSV Input

The CSV Parser node acts on a single string input – it expects this string to contain the CSV data when invoked at runtime.

 

CSV Parser options and data schema

When configuring the node, you provide a small sample of the CSV data you want to parse, which the node uses to work out the structure of the data you’re using; for example:


FirstName,LastName,Address,City,Postcode,EMail
First1,Last1,”1 Street, Town1″,City1,AB1 1CD,mail1@customer1.com
First2,Last2,”2 Street, Town2″,City2,AB2 2CD,mail2@customer2.com

  1. Paste your sample CSV data into the ‘example CSV’ box.
  2. If your CSV starts with a ‘header’ line that names the fields (as in the example CSV data above), then select the checkbox ‘First row of the CSV data is a header’.
  3. Click ‘Generate Schema’

This creates the JSON schema that describes the structure of your CSV data.
If you used the ‘First row of the CSV data is a header’ option, then each field is named according to the ‘header’ data for the relevant column.


“FirstName”,
“LastName”,

If not, then the fields are just numbered;

“field1”,
“field2”,

This structure is used throughout the rest of the flow. You can leave this completely untouched.

3. Use the output from the CSV Parser in subsequent nodes

The output from the CSV Parser node is an array in which each element has the structure generated from your sample. The following screenshot shows the structure being used as part of the ‘For each’ node. Notice that the field names are the same as the first line of the CSV sample:

 

Summary

This article has given a brief overview of the usage of the CSV Parser node in IBM App Connect. Watch this site for further updates and example on App Connect and the CSV Parser node.

2 comments on"How to process tabular data using the CSV Parser node in App Connect"

  1. RobPhippen November 03, 2017

    Thank you Peter – I have folded a link to your video into the article!

    Reply (Edit)
  2. Peter Broadhurst October 23, 2017
    here

    You can see a demo of this functionality here: https://www.youtube.com/watch?v=ypNH-gSu03I

    Reply (Edit)