我正在使用脚本转换运行SSIS作业。这将读取文件,收集数组中的数据,并在键发生更改时从数组中输出数据。但是,这似乎并不处理最后一个记录/数组,因为似乎没有执行EndofRowset。这被设置为异步脚本转换。除了选择最后一个数组
之外,所有代码都有效以下是精简代码..
Public Overrides Sub MyInput_ProcessInputRow(ByVal Row As MyInputBuffer)
While Row.NextRow()
Process_recs(Row.AOS, Row.Session, Row.AOSTitle, CInt(Row.ResourceHrs), CInt(Row.TotalTargetNo))
End While
If Row.EndOfRowset Then
MsgBox("LAST RECORD " & CStr(QTUT_count))
do_output_data(QTUT_count, strAOS, IntTargetplusHours, StrQTUT)
End If
End Sub
Public Sub Process_recs(ByRef subAOS As String, ByRef subSession As String, ByRef subAOStitle As String, ByRef subResourceHrs As Integer, ByVal subTotalTargetNo As Integer)
'code here collects data in an aray and sends to output on change of key
do_output_data(QTUT_count, strAOS, IntTargetplusHours, StrQTUT)
End Sub
Public Sub do_output_data(ByVal QT_count As Integer, ByVal aos() As String, ByVal hrs() As Integer, ByVal QTUT() As String)
'data moved from array and output
.AddRow()
.Group = Trim(aos(k)) + StrSuffix
.SubGroup = Trim(aos(intindex))
End Sub
Public Overrides Sub CreateNewOutputRows()
End Sub
Public Overrides Sub PostExecute()
End Sub
Public Overrides Sub PrimeOutput(ByVal Outputs As Integer, ByVal OutputIDs() As Integer, ByVal Buffers() As Microsoft.SqlServer.Dts.Pipeline.PipelineBuffer)
MyBase.PrimeOutput(Outputs, OutputIDs, Buffers)
End Sub
答案 0 :(得分:1)
>>> limits.__class__.__name__
'3Tuple'
将为每一行执行。使用而的目的是什么,删除while循环。
您可以使用其他方法检查最后一行:
public override void InputRows_ProcessInputRow(InputRowsBuffer Row)
DFT RowCount
中添加DFT RowCount
和Flat File Source
组件RowCount
)User::FileRowCount
连接到您正在使用的DatafLow任务DFT RowCount
添加到脚本User::FileRowCount
使用以下代码:
ReadOnlyVariables