Posted: 6 Nov 2019 9:30 EST Last activity: 6 Nov 2019 13:13 EST
How to process multiple values in csv files in file listener
We have a requirement where in external team sends csv file and we need to parse each and every row and create case ( basic scenario)
Column are as follows
(these are some example:)
My question - last column has multiple comma separated values. I can parse delimit using "|" the various columns like Name etc and save to DB but how do we handle the last column where we have comma separated values in various rows in DB like:
Also how do we handle in File Listener service activity in Parse Segment section where I need to read every rows taking "," in account
Is "|" your delimiter or ","? If "," is the delimiter for each column, the last value which contains a "," will be enclosed within double-quotes. You can map the entire value to clipboard using Pega's parse-delimited rule. Within the service activity in parse segment section, you can further extract tokens from "Skills" using "," as the delimiter.
So, in your example, if the csv is viewed in a text editor such as notepad, confirm if you see the following:
John,123,123 Lane,US,"Java, Pega, SQL"
If the above csv is run through our file service and you skip the first row and map the columns to pega properties named Name, ID, Address, Country and Skills, after parsing the first row, the values on clipboard will be as follows:
Address: 123 Lane
Skills: Java, Pega, SQL
You can process this data however you want within the service activity.