Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Only at Qlik Connect! Guest keynote Jesse Cole shares his secrets for daring to be different. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Array Parsing

Hi 

 

I have an array on my input rows that looks a little like this...

 

["xx0683p000009MAB6.pngrofile\/friend_of_owner","xx0683p000009MAB6.pngrofile\/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

Labels (2)
1 Reply
Anonymous
Not applicable
Author

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.

0683p000009M1Fy.png

 

 

The first step is normalize the input string as shown below.0683p000009M1G3.png

 

 

Next is the parsing of data using a tmap

0683p000009M0w5.png

 

 

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