Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a following string which I need to split based on 2 delimiters. Will be using tJavaRow to split this.
["Test Company, Inc.","Test Company (Test) LLC","VM (Test), LLC","JK (Test), LLC"]
Need result such as:
Test Company, Inc.
Test Company (Test) LLC
VM (Test), LLC
JK (Test), LLC
Process separately Value and Label using the way I provided in my previous post.
Next, add a sequence id to each row, eg:
Numberic.sequence("value",1,1)
Finally, do an inner join based on sequence id to merge two columns Value and Label.
Regards
Shong
Hi
First, remove the square brackets "[","]" from the string on a tJavaRow.
Then, use tNormalize to normlize the line to multiple rows using item seperator "\","
Finally, remove the double quotes from each value on a tJavaRow2.
output_row.line = input_row.line.replaceAll("\"","");
Result:
Starting job testing at 11:06 01/12/2021.
[statistics] connecting to socket on port 3346
[statistics] connected
Test Company, Inc.
Test Company (Test) LLC
VM (Test), LLC
JK (Test), LLC
[statistics] disconnected
Job testing ended at 11:06 01/12/2021. [Exit code = 0]
Regards
Shong
Thanks Shong for the above solution.
I have another column which contains a picklist id which needs to be associated to this. I've tried adjusting your code to get the result,
but no success.
|Value |Label
|=------------------------------------------------------------------------------------------+----
|[1000,1002,2200,3400]|["Test Company, Inc.","Test Company (Test) LLC","VM (Test), LLC","JK (Test), LLC"]
-------------------------------------------------------------------------------------------+-----
Need result such as this in 2 separate columns:
Value Label
1000 Test Company, Inc.
1002 Test Company (Test) LLC
2200 VM (Test), LLC
3400 JK (Test), LLC
Process separately Value and Label using the way I provided in my previous post.
Next, add a sequence id to each row, eg:
Numberic.sequence("value",1,1)
Finally, do an inner join based on sequence id to merge two columns Value and Label.
Regards
Shong
Shong, your recommendation worked with little twick of using tReplace component.
For others reference, this is how I've designed the job.
Input file: