I have a large text file which has multiple different rows within it.
I am using a Conditional Split which looks at the row type (Field 1) and then takes an action, mostly trying to increment a variable, split the single row into multiple columns (Derived) and then write the results to a table.
However, when trying to increment the variable, I am getting "The collection of variables locked for read and write access is not available outside of PostExecute."
The variable is being updated with a script component.
I have tried moving the code to the PostExecute however at that point, it never seems to increment.
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
Dim MaximumKey As Int32 = Me.Variables.SPIParentID ' Grab value of MaxKey which was passed in
' NextKey will always be zero when we start the package.
' This will set up the counter accordingly
If (NextKey = 0) Then
' Use MaximumKey +1 here because we already have data
' and we need to start with the next available key
NextKey = MaximumKey + 1
Else
' Use NextKey +1 here because we are now relying on
' our counter within this script task.
NextKey = NextKey + 1
End If
'Row.pkAAAParentID = NextKey ' Assign NextKey to our ClientKey field on our data row
Me.Variables.SPIParentID = NextKey
End Sub
I would like to be able to loop through the file using the conditional split I have in place, then when it reached a certain record type it will take the current RecordTypeID and increment it to then write out to the next record.