我正在以编程方式创建聚合转换,其聚合类型为不同的计数,并且我能够创建其他聚合,如最小,最大,计数..但是当涉及到不同的计数时,我的错误率将低于误差
该组件在检测到潜在的元数据损坏 验证。数据流任务时发生错误-负载计数距离[总计- 全部[2]]:“汇总-全部。输出[汇总输出 1] .Columns [col1]“缺少必需的属性 “ CountDistinctScale”。该对象必须具有指定的 自定义属性。
我无法找到“ CountDistinctScale”自定义属性,因为该自定义属性不会退出以进行其他聚合,并且在选择计数不同时会神奇地出现,是否需要调用一种方法来创建新的自定义属性?>
我了解没有多少人知道如何以编程方式创建软件包,请帮助我找到有知识的人或向我建议如何获得帮助。
IDTSComponentMetaData100 Aggregate = pipeline.ComponentMetaDataCollection.New();
Aggregate.ComponentClassID = app.PipelineComponentInfos["Aggregate"].CreationName;
// Get the design time instance of the derived column
var DesignAggregate = Aggregate.Instantiate();
DesignAggregate.ProvideComponentProperties(); //design time
Aggregate.Name = "AggregateComponent";
IDTSPath100 AggregatePath = pipeline.PathCollection.New();
AggregatePath.AttachPathAndPropagateNotifications(pipeline.ComponentMetaDataCollection[Prev_Transform.Transformation_Name].OutputCollection[Prev_Transform.Output_Number], Aggregate.InputCollection[0]);
//update the metadata for the derived columns
DesignAggregate.AcquireConnections(null);
DesignAggregate.ReinitializeMetaData();
DesignAggregate.ReleaseConnections();
// Mark the columns we are joining on
IDTSInput100 AggregateInput = Aggregate.InputCollection[0];
IDTSInputColumnCollection100 AggregateInputColumns = AggregateInput.InputColumnCollection;
IDTSVirtualInput100 AggregateVirtualInput = AggregateInput.GetVirtualInput();
IDTSVirtualInputColumnCollection100 AggregateVirtualInputColumns = AggregateVirtualInput.VirtualInputColumnCollection;
IDTSOutput100 AggregateoutputCollection = Aggregate.OutputCollection[0];
// Note: input columns should be marked as READONLY
foreach (IDTSVirtualInputColumn100 vColumn in AggregateVirtualInputColumns)
{
int sourceColumnLineageId = AggregateVirtualInput.VirtualInputColumnCollection[vColumn.Name].LineageID;
DesignAggregate.SetUsageType(AggregateInput.ID, AggregateVirtualInput, sourceColumnLineageId, DTSUsageType.UT_READONLY);
// create a new output column
IDTSOutputColumn100 newOutputColumn = DesignAggregate.InsertOutputColumnAt(AggregateoutputCollection.ID, 0, vColumn.Name, string.Empty);
// set the data type porperties to the same values as these of the input column
newOutputColumn.SetDataTypeProperties(AggregateVirtualInput.VirtualInputColumnCollection[vColumn.Name].DataType, AggregateVirtualInput.VirtualInputColumnCollection[vColumn.Name].Length, 0, 0, AggregateVirtualInput.VirtualInputColumnCollection[vColumn.Name].CodePage);
newOutputColumn.MappedColumnID = 0;
for (int i = 0; i < newOutputColumn.CustomPropertyCollection.Count; i++)
{
IDTSCustomProperty100 property = newOutputColumn.CustomPropertyCollection[i];
switch (property.Name)
{
case "AggregationColumnId":
property.Value = sourceColumnLineageId;
break;
case "AggregationType":
property.Value = 3;
break;
case "IsBig":
property.Value = 1;
break;
case "AggregationComparisonFlags":
property.Value = 0;
break;
}
}
}