Transformation script last row

Hello,

in an asynchronous transformation script, how can i know when the script reach the last input row


Answer this question

Transformation script last row

  • 112ilias

    That section was added in the 1st week of May...I would have expected it to make the June CTP but can't easily verify.   -Doug


  • Cesaremsdn

    Hello,

    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

    i = 0

    End With

    End If

    i = i + 1
    End Sub

    End Class


     


    thanks a lot for your help

  • m00gle

    Doug, I'm sure the topics are there now, but are they there in the June CTP release of BOL I can't find them.

    Darren

  • Marilyn Beaudreau

     Coroebus wrote:
    Hello,

    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


  • VinnyD

    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.

    HTH,

  • Serene Seraph

    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.

    -Doug

  • dmongosa

    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.

    -Doug

  • Chrisella

     Jamie Thomson wrote:
     Coroebus wrote:
    Hello,

    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

    Hope that helps.

    -Jamie



  • The Other Dennis

    The problem is in ComponentWrapper, the code is read-only ...



  • Transformation script last row