Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I have an array on my input rows that looks a little like this...
["xxrofile\/friend_of_owner","xx
rofile\/vip","xx:service\/alert_manager"]
...and I want to split this to build out a tall, thin table in a database to store in 3 columns
row 1 - column1: id
row 1 - column2: profile
row 1 - column:3:friend_of_owner
row 2 - column1: id
row 2 - column2: profile
row 2 - column:3:vip
row 3 - column1: id
row 3 - column2: service
row 3 - column:3: alert_manager
Each row varies in array size and so some will transpose to 1 row, 2 rows, 3 and so on...
Any ideas how I can sort this data out in Talend Open Studio.
Thanks
Dave
Hi Dave,
My assumption is that you are storing this input value in a String variable. Based on that, I created below job which was able to parse the data.
The first step is normalize the input string as shown below.
Next is the parsing of data using a tmap
column2 row2.input.substring(row2.input.indexOf(":") + 1, row2.input.indexOf("\\")) column3 row2.input.substring(row2.input.indexOf("/") + 1,row2.input.lastIndexOf("\""))
Once you do this setup, you will be able to parse the data.
Could you please mark the topic as resolved since I have answered your query? Kudos are also welcome 🙂
Warm Regards,
Nikhil Thampi