1

I am working with EZApi to assist in creating a package to stage data for transformation. It is working in terms of data movement. When opening the package in the designer however there are warning messages surrounding the Derived Column and the InputColumns being set to read only.

Warning 148 Validation warning. Staging TableName: {AA700319-FC05-4F06-A877-599E826EA833}: The "Additional Columns.Inputs[Derived Column Input].Columns[DataSourceID]" on "Additional Columns" has usage type READONLY, but is not referenced by an expression. Remove the column from the list of available input columns, or reference it in an expression. StageFull.dtsx 0 0

I can manually change them in the designer to be Read/Write or unselect them and the warning goes away. I am unable to get this to work programmatically however.

I have tried removing the columns from the metadata which works but doesn't remove them from the component so the columns are still created in the xml.

XML section

<externalMetadataColumn refId="Package\Full\Staging TableName\DestinationStaging TableName.Inputs[OLE DB Destination Input].ExternalColumns[DataSourceID]" dataType="i4" name="DataSourceID" />

When I try to go to the underlying object and delete the column using component.DeleteInput(id) I get an error message stating that the input column cannot be removed.

0xC0208010
-1071611888
DTS_E_CANTDELETEINPUT
An input cannot be deleted from the inputs collection.

Here is the code I am using to create a data flow task with an OLEDB Source, Derived Column, and OLE DB Destination.

Note that the input columns are not present until after the derived column is attached to the Source: dc.AttachTo(source);

 public class EzMyDataFlow : EzDataFlow
    {
        public EzMyDataFlow(EzContainer parent, EzSqlOleDbCM sourceconnection,
          EzSqlOleDbCM destinationconnection, string destinationtable, string sourcecomannd, string dataflowname)
            : base(parent)
        {
            Name = dataflowname;

            EzOleDbSource source = new EzOleDbSource(this);
            source.Connection = sourceconnection;
            source.SqlCommand = sourcecomannd;
            source.AccessMode = AccessMode.AM_SQLCOMMAND;
            source.Name = string.Format("Source_{0}", dataflowname);

            EzDerivedColumn dc = new EzDerivedColumn(this);

            dc.Name = "Additional Columns";

            // Setup DataSourceID
            string columnName = DBSchema.ReportFoundationalColumns.DataSourceID;
            dc.InsertOutputColumn(columnName);
            dc.SetOutputColumnDataTypeProperties(columnName, DataType.DT_I4, 0, 0, 0, 0);
            var c = dc.OutputCol(columnName);
            var property = c.CustomPropertyCollection["Expression"];
            property.Name = "Expression";
            property.Value = "@[TM::SourceDatabaseID]";
            property = c.CustomPropertyCollection["FriendlyExpression"];
            property.Name = "FriendlyExpression";
            property.Value = "@[TM::SourceDatabaseID]";

            dc.AttachTo(source);

            EzOleDbDestination destination = new EzOleDbDestination(this);
            destination.Table = destinationtable;
            destination.Connection = destinationconnection;
            destination.Name = string.Format("Destination{0}", dataflowname);
            destination.AttachTo(dc);
        }
    }
tsells
  • 2,751
  • 1
  • 18
  • 20
  • Have you seen http://stackoverflow.com/questions/19529606/automatically-mapping-columns-with-ezapi-with-oledbsource The code you have for your derived column seems *off* but I don't have time to dig into it – billinkc Feb 25 '14 at 19:14
  • Yes. I believe I used your post to help guide my direction initially. The only thing I didn't have was the LinkallInputsToOutputs call after the last Destination attach to the derived column. Doing that made no difference. What warnings were you getting? You mentioned in your answer that you received warnings in the UI. – tsells Feb 25 '14 at 19:26
  • I answered the duplicate of this question http://stackoverflow.com/questions/24031748/warning-messages-with-ezapi-ezderivedcolumn-and-input-columns/27234365#27234365 – Kyle Hale Dec 01 '14 at 18:02

0 Answers0