Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
ashish_2511
Creator
Creator

Load Script - Break a string field into substrings and load in different rows

Hi There

Below are snaps of input and output tables, Please suggest a way to achieve this in load script.

   

Input
IDData
1Row1|Row2|Row3|Row4
Output
IDData
1Row1
2Row2
3Row3
4Row4

Thanks!

-Sneh

1 Solution

Accepted Solutions
Anil_Babu_Samineni

May be thihs?

LOAD RowNo() as ID, SubField(Data,'|') as Data Inline [

ID, Data

1, Row1 | Row2 | Row3 | Row4

];

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

7 Replies
Anil_Babu_Samineni

Script:

LOAD ID, SubField(Data,'|') as Data Inline [

ID, Data

1, Row1 | Row2 | Row3 | Row4

];

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
vinieme12
Champion III
Champion III

Load

I'D,

Subfield (Data,'|') as Data

From xxxx;

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
ashish_2511
Creator
Creator
Author

Anil - Thanks a lot for the quick turn around.

This didn't solve my problem completely as it gives me an output like this -

Whereas in expected output table - ID should be - 1,2,3,4

ashish_2511
Creator
Creator
Author

Vineeth - Thanks a lot for the quick turn around.

This didn't solve my problem completely as it gives me an output like this -

Whereas in expected output table - ID should be - 1,2,3,4

Anil_Babu_Samineni

May be thihs?

LOAD RowNo() as ID, SubField(Data,'|') as Data Inline [

ID, Data

1, Row1 | Row2 | Row3 | Row4

];

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
ashish_2511
Creator
Creator
Author

Cool . This solves my problem completely.

Thanks!

Sneh

vinieme12
Champion III
Champion III

Try below, assuming an I'd relates to a group of data and is unique to each group , you need to use autonumber ()

Load

I'D,

AUTONUMBER (I'D, DATA) AS INSTANCE I'D,

Data;

LOAD

ID, SubField(Data,'|') as Data

From xxxx;

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.