How to skip records in script component

In DTS activex task, you can use skipinsert to skip a row, how to do that in script component


Answer this question

How to skip records in script component

  • BCullenward9

    BUT....

    If the script component is doing a lot of work (e.g. Tokenising a single column of large strings), of which you only want to process some, then there are significant speed gains by directing the row within the script.

    If the table is quite small, this may not be a concern to you - but if you're using the script component as a workaround for importing data with a variable number of columns, you'll be glad of the above advice

    As usual, horses for courses...

    Smile

    S.


  • Hugo Pozo

    Apology accepted. But I don't think SSIS is more intuitive in this case though, You have to figure out to set exclusion group to none 0, otherwise, you even don't see DirectRowToOutput in intellisense.

  • Rob DeLine

    OK. We'll agree to disagree :)

    -Jamie



  • BrunoRdaSilva

    I had the same problem :)

    Finally I've used the Conditional Split component..

    Regards

  • Alex_Sig

    In your ProcessInputRow method, simply use an If test or other control structure to identify the rows that you don't want to process, then...do nothing!

    Note that if you have a component with synchronous outputs, then the same buffers full of rows that come into your component are passed back out as outputs, whether you choose to process those rows or not. If you want to delete rows from the output -- not just skip your custom processing for some rows -- you would need to configure asynchronous outputs.

    BOL's content on the Script component should be very helpful to you as you use it the first few times.

    -Doug


  • s potluri

    Apologies if my tone was misinterpreted. It was a serious point I made though. I'm keen to understand why you think this method in SSIS is more difficult.

    I admit I maintain a healthy scepticism about the value of the ActiveX Script Task in DTS for many reasons - mainly its slow performance. In both DTS and SSIS though you are simply building a script and in fact the SSIS method is, I feel, more intuitive and no more difficult to build.

    With the SSIS method you don't even have to write any code to get rid of the row. What is easier than that

    Just my opinion!

    -Jamie

     



  • CraigZ

    Matt, Row.DirectRowToOutpot() is what I am using. Your post proves I am not doing something stupid. It should have an easier way to skip.

    Thanks



  • Klaus65

    That is not entirely correct. If you change the exclusion group to something other than 0 then you can "delete" rows to a synchronous output. Call DirectRow on any row you want to keep and just don't call anything on any row you don't want to keep.

    This is slightly different for a script component since it does the looping for you, etc so here is an example

    Set Exclusion group on your output to 1 in the designer

    In Input0_ProcessInputRow(Row as Input0Buffer):

    if KeepThisRow(row) then

    Row.DirectRowToOutput()

    end if



  • TheDoctor30306

    Wei Wang father of twins wrote:

    Matt, Row.DirectRowToOutpot() is what I am using. Your post proves I am not doing something stupid. It should have an easier way to skip.

    Thanks

    I would love to know what is easier than not having to do anything!

    -Jamie



  • fahadmoon

    I don't like the tone. What I was saying is skip in DTS is more straightforward. In the SSIS, you have to set exclusion group to none 0 first. Acting like a bull is not something you should do in this forum.

  • Kaarthik Sivashanmugam

    I have a really easy solution to this:

    Don't do any filtering your script component. Simply add a conditional split task after your script component that only allows rows you want (via an expression) to pass to the next task...


  • How to skip records in script component