I am using a script component to transform data. In the script component I created a bunch of fields for the output. Is there any way to loop through that list of columns? Is there code I can use in the script component to access the names, data types, data etc?
I saw a lot of informaiton on the OutputColumnCollection as part of some IDTSOuput90 thing (greek to me). As best I can guess this is for creating your own new columns, but can I see what columns are already defined via the script interface?
I was able to get a specific column by doing this...
Dim o As IDTSOutput90
o = ComponentMetaData.OutputCollection.GetObjectByID(88)
MsgBox("Column Count: " & o.OutputColumnCollection.Count)
MsgBox("Colum: " & o.OutputColumnCollection.FindObjectByID(139).Name)
But Is there a way to just loop through all the ids? I have to know the id to stick in findobjectbyid(x). Can i do a loop and have x = all the ids? Additionally the 88 is hard code value... is there a way to get the current or specific output set?
The ultimate goal is to loop through the column collection and set a column = value. Basically I have an array of values and want to loop through the columns and set it to the array postion.
|||Ok... sorry about the multiple posts here... but I got some more logic to work...
I was able to get able to get columns by doing this...
Dim o As IDTSOutput90
o = ComponentMetaData.OutputCollection.GetObjectByID(88)
For Each col As IDTSOutputColumn90 In o.OutputColumnCollection
MsgBox("Name: " & col.Name)
Next
So the updated question is this...
The ultimate goal is to loop through the column collection and set a column = value. Basically I have an array of values and want to loop through the columns and set it to the array postions value. I can't find how to set the column value equal to something while i loop through it. Additionally... is there a reference or good way to get the data type? When i use the col.datatype is returns a number vs description. I want to have logic when it set the value to do coverts based on the data type.
No comments:
Post a Comment