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|ISYS|LFCT|LPMCO-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.
SharonBernalAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rainer JeschorCommented:
Hi,
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:
public override void Input0_ProcessInputRow(Input0Buffer Row)
    {
        string[] separator = { "|" };
        string[] splittedLine = Row.Line.Split(separator, StringSplitOptions.None);
        OutputSplittedBuffer.AddRow();
        OutputSplittedBuffer.KeyFieldOut = Row.KeyField;
        OutputSplittedBuffer.Field1 = splittedLine[0];
        OutputSplittedBuffer.Field2 = splittedLine[1];
    }

Open in new window


HTH
Rainer
0
SharonBernalAuthor Commented:
I'm not sure how to implement your code into my script. My script is below:

Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
        Dim keyField As Integer = Row.KeyField
        Dim itemList As String = Row.Line
        Dim delimiter As String = "|"

        If Not (String.IsNullOrEmpty(itemList)) Then

            Dim inputListArray() As String = _
                itemList.Split(New String() {delimiter}, _
                StringSplitOptions.RemoveEmptyEntries)

            For Each item As String In inputListArray
                With Output0Buffer
                    .AddRow()
                    .KeyField = keyField
                    .ClaimNumber = item
                   
                End With
            Next

        End If

    End Sub
0
SharonBernalAuthor Commented:
I found a way to get this to work using VB.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SharonBernalAuthor Commented:
I have found an alternative solution.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.