SharonBernal
asked on
SSIS Script Component Transformation
I have a table that has a key field and one field with a line of | pipe delimited data like this:
KeyField Line
1 20120828|20|20.500|CLO|ISY S|LFCT|LPM CO-LP2
I have a script component that breaks this down as follows:
1 20120828
1 20
1 20.500
1 CLO
1 ISYS
1 LFCT
1 LPMCO-LP2
What I want is a horizontal row, not a vertical one.
ID FIELD1 FIELD2 FIELD3 FIELD4 FIELD5 FIELD6 FIELD7
1 20120828 20 20.500 CLO ISYS LFCT LPMCO-LP2
Is there something that I can use in Script Component? Right now it does an .AddRow.
KeyField Line
1 20120828|20|20.500|CLO|ISY
I have a script component that breaks this down as follows:
1 20120828
1 20
1 20.500
1 CLO
1 ISYS
1 LFCT
1 LPMCO-LP2
What I want is a horizontal row, not a vertical one.
ID FIELD1 FIELD2 FIELD3 FIELD4 FIELD5 FIELD6 FIELD7
1 20120828 20 20.500 CLO ISYS LFCT LPMCO-LP2
Is there something that I can use in Script Component? Right now it does an .AddRow.
ASKER
I'm not sure how to implement your code into my script. My script is below:
Public Overrides Sub Input0_ProcessInputRow(ByV al Row As Input0Buffer)
Dim keyField As Integer = Row.KeyField
Dim itemList As String = Row.Line
Dim delimiter As String = "|"
If Not (String.IsNullOrEmpty(item List)) Then
Dim inputListArray() As String = _
itemList.Split(New String() {delimiter}, _
StringSplitOptions.RemoveE mptyEntrie s)
For Each item As String In inputListArray
With Output0Buffer
.AddRow()
.KeyField = keyField
.ClaimNumber = item
End With
Next
End If
End Sub
Public Overrides Sub Input0_ProcessInputRow(ByV
Dim keyField As Integer = Row.KeyField
Dim itemList As String = Row.Line
Dim delimiter As String = "|"
If Not (String.IsNullOrEmpty(item
Dim inputListArray() As String = _
itemList.Split(New String() {delimiter}, _
StringSplitOptions.RemoveE
For Each item As String In inputListArray
With Output0Buffer
.AddRow()
.KeyField = keyField
.ClaimNumber = item
End With
Next
End If
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I have found an alternative solution.
a script transformation can do this but you have to do some configuration (as the default settings would not allow this).
Just configure your Output (Script Transformation Editor -> Inputs and Outputs) and set "SynchronousInputID" to "None" and add columns to your output like "KeyFieldOut", "Field1","Field2" ...
Then you can simply use this in your script:
Open in new window
HTH
Rainer