You do not edit the code in the ComponentWrapper project item. You would override the FinishOutputs method in your ScriptMain class, which inherits from the class defined in the ComponentWrapper item.
Please note that this is explained in BOL in the topic "Using the Script Component Object Model" within the larger section "Extending the Data Flow with the Script Component," which consists of more than a dozen topics of information and examples.
i'm making Packet of 200 Yahoo stock code in a row, in my loop, when i reach 200 i create a row in output buffer.
The problem is if reach the last input row, i have lost the last codes because they are not in output row
look at my code :
Public
Class ScriptMain Inherits UserComponent Dim i As Integer = 1 Dim NbCode As Integer = 200 ' Number of Yahoo! codes per output row Dim liste As String = Nothing ' the string containing the output row Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
liste = liste & Row.CodeYahoo
If i < NbCode Then liste = liste & "," If i = NbCode Then With Output0Buffer 'Ajoute une ligne au buffer de sortie .AddRow() 'Set the values of the output buffer column .Sortie = liste ' Reset Liste value liste = Nothing
Checking for EndOfRowset on the input buffer can be used to check for the end of input rows, although of course you can also simply wait until ProcessInputRow is no longer being called.
PrimeOutput is always called before ProcessInput in a component that needs both, so CreateOutputRows is called before input rows are processed. Thus the modest example of a Script Transformation with Asynchronous Outputs in BOL shows adding a single new output row in CreateOutputRows, but populating its column values later at the end of an overridden ProcessInput after those values have been aggregated from all the input rows.
If you look in the ComponentWrapper module you will see a FinishOutputs method. You can put code in here to add the final values in liste to your output. You should look at MarkOutputsFinished method and wrap your code in the same if that is in this code since there is a possibility that there is no output buffer.
in an asynchronous transformation script, how can i know when the script reach the last input row
<buffer_name>.EndOfRowset() returns a boolean value indicating this.
-Jamie
Hang on, sorry, I've just realised that you said asynchronous, not synchronous.
If you are building an asynchronous component then you have no need to know whether or not you have reached the last row because ProcessInputRow(row) is called for every row in the input buffer. You don't have to worry about when you reach the end of the input buffer.
I may be wrong but when CreateOutputRows() is called I think its safe to assume that all of the input rows have been processed.
Why do you want to know when you have reached the last row
Transformation script last row
Jeff Pettiross - MS
Please note that this is explained in BOL in the topic "Using the Script Component Object Model" within the larger section "Extending the Data Flow with the Script Component," which consists of more than a dozen topics of information and examples.
-Doug
Prometheus666
i'm making Packet of 200 Yahoo stock code in a row,
in my loop, when i reach 200 i create a row in output buffer.
The problem is if reach the last input row, i have lost the last codes because they are not in output row
look at my code :
Public
Class ScriptMainInherits UserComponent
Dim i As Integer = 1
Dim NbCode As Integer = 200 ' Number of Yahoo! codes per output row
Dim liste As String = Nothing ' the string containing the output row Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
liste = liste & Row.CodeYahoo
If i < NbCode Then liste = liste & ","If i = NbCode Then With Output0Buffer 'Ajoute une ligne au buffer de sortie
.AddRow()
'Set the values of the output buffer column
.Sortie = liste ' Reset Liste value
liste = Nothing
i = 0
End With End Ifi = i + 1
End SubEnd
Classthanks a lot for your help
VeePee
Darren
Hargen
<buffer_name>.EndOfRowset() returns a boolean value indicating this.
-Jamie
Steve_fr88
Farid_Z
PrimeOutput is always called before ProcessInput in a component that needs both, so CreateOutputRows is called before input rows are processed. Thus the modest example of a Script Transformation with Asynchronous Outputs in BOL shows adding a single new output row in CreateOutputRows, but populating its column values later at the end of an overridden ProcessInput after those values have been aggregated from all the input rows.
-Doug
arstacey
HTH,
Ruxo
Hang on, sorry, I've just realised that you said asynchronous, not synchronous.
If you are building an asynchronous component then you have no need to know whether or not you have reached the last row because ProcessInputRow(row) is called for every row in the input buffer. You don't have to worry about when you reach the end of the input buffer.
I may be wrong but when CreateOutputRows() is called I think its safe to assume that all of the input rows have been processed.
Why do you want to know when you have reached the last row
Hope that helps.
-Jamie
tyrone_dude
The problem is in ComponentWrapper, the code is read-only ...