Yesterday I have to dig into my old repository to add a derived column into a package, eventually I was able to figured that out, but here it is just as a remainder that somethings are like zombies, don't matter how many times to shoot them if is not in the head they come back :-)
//Add Derive Column for BatchId
PipelineWrapper.IDTSComponentMetaData100 icmdDeriveRawColumn = AddComponentMetadata(RawDataFlow, "AddBatchIdColumn");
icmdDeriveRawColumn.ComponentClassID = "DTSTransform.DerivedColumn";
PipelineWrapper.CManagedComponentWrapper mcwDeriveRawColumn = icmdDeriveRawColumn.Instantiate();
mcwDeriveRawColumn.ProvideComponentProperties();
icmdDeriveRawColumn.InputCollection[0].ExternalMetadataColumnCollection.IsUsed = false;
icmdDeriveRawColumn.InputCollection[0].HasSideEffects = false;
Reinitiaze(mcwDeriveRawColumn);
PipelineWrapper.IDTSOutputColumn100 BatchIdCol = icmdDeriveRawColumn.OutputCollection[0].OutputColumnCollection.New();
BatchIdCol.Name = "BatchId";
BatchIdCol.SetDataTypeProperties(RuntimeWrapper.DataType.DT_WSTR,8,0,0,0);
BatchIdCol.ExternalMetadataColumnID = 0;
BatchIdCol.ErrorRowDisposition = PipelineWrapper.DTSRowDisposition.RD_FailComponent;
BatchIdCol.TruncationRowDisposition = PipelineWrapper.DTSRowDisposition.RD_FailComponent;
PipelineWrapper.IDTSCustomProperty100 BatchColProp = BatchIdCol.CustomPropertyCollection.New();
BatchColProp.Name = "Expression";
BatchColProp.Value = "@[User::strBatchId]";
BatchColProp = BatchIdCol.CustomPropertyCollection.New();
BatchColProp.Name = "FriendlyExpression";
BatchColProp.Value = "@[User::strBatchId]";
No comments:
Post a Comment