views:

1237

answers:

2

I have an SSIS script component which takes in rows from input.

One of the rows on the input is a boolean which identifies if the row is of type A or B.

How do I get the script to load all of the input rows into the correct collection of rows.

Also any guides on how to use the row collections and then output them would be great too.

A: 

Since the script component is using VB, it would be something like

If Column(type) = True Then
  CollectionA.Add(row)
Else
  CollectionB.Add(row)
End If

However, you may want to look into using a DataTable, as it more closely represents what you are trying to store.

There is an event that you can tie to that executes when all the rows have gone through the component. When that event executes you can move the data from the DataTables into some variables that exist in the dataflow. If you type these variables as Table values, I believe that you can ten work with those variables in the dataflow.

Your best bet may be to put this entire operation into a seperate DataFlow component within your control flow, as it sounds as though you may be changing the number of rows coming out, and your best bet may be to use multiple DataFlow components.

MasterMax1313
what I need to do is this, perhaps I'm trying to solve the problem the wrong way...I have two identical tables one for communication and one for calls.I want two collection one for each table.Then you go through the call table and for each row see if you can find a comm with the same date. If you can copy the comm into the result, if you cant you use the call. You should never reuse the same comm.
Craig Warren
Personally I would just do a normal join then. Not a LookUp, but a straight join. I'm assuming you don't want granularity down to the time, but just the day, in which case you can do a join by converting the two DateTime fields to VarChar(10) fields (truncating the time) and join on the converted fields. This will probably result in a many to many matching, but sounds like it should give you what you're looking for.
MasterMax1313
I dont want the many to many matching that't the problem. I want to remove the calls if I can find a communication on the same day to replace it with. But I should never use the same communication to replace two separate calls
Craig Warren
A: 

You may be able to use something like what Jamie Thomson did in his blog entry here:

http://consultingblogs.emc.com/jamiethomson/archive/2005/09/05/SSIS-Nugget_3A00_-Multiple-outputs-from-a-synchronous-script-transform.aspx

He uses the script component and splits the output into several output streams depending upon conditions. He explains very concisely in his post how to configure the component and how to send the proper rows to the proper output stream. Hope this is what you were looking for.

William Todd Salzman