Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Script component runtime error

$
0
0

I have a  package to update and create contacts from a database to an application. So far it is working fine. But if one of the input columns has null value it throws this error:

Condition for attribute 'new_lapinterpreter.new_interpreterlanguage': null is not a valid value for an attribute. Use 'Null' or 'NotNull' conditions instead.


I've used lookup transformation to avoid duplicate insertions and mapped the columns accordingly.

Here is my code:

public override void ContactInput_ProcessInputRow(ContactInputBuffer Row)
    {
        bool hasDulicate = false;
        FilterExpression codeFilter = new FilterExpression(LogicalOperator.And);
        codeFilter.AddCondition("new_interpretername", ConditionOperator.Equal, Row.fullname);
        codeFilter.AddCondition("new_interpreterlanguage", ConditionOperator.Equal, Row.newprimarylanguage);
        codeFilter.AddCondition("new_emailintlap", ConditionOperator.Equal, Row.emailaddress1);
        codeFilter.AddCondition("new_primaryphoneintlap", ConditionOperator.Equal, Row.mobilephone);

        QueryExpression query = new QueryExpression
        {
            EntityName = "new_lapinterpreter",
            ColumnSet = new ColumnSet(true),
            Criteria = codeFilter
        };
        EntityCollection records = _orgService.RetrieveMultiple(query);
        int totalrecords = records.Entities.Count;
        foreach (Entity record in records.Entities)
        {
            if (record["new_interpretername"] != null)
            {
                record["new_interpretername"] = Row.fullname;
            }

            if (record["new_interpreterlanguage"] != null)
            {
                record["new_interpreterlanguage"] = Row.newprimarylanguage;
            }

            if (record["new_emailintlap"] != null)
            {
                record["new_emailintlap"] = Row.emailaddress1;
            }

            if (record["new_primaryphoneintlap"] != null)
            {
                record["new_primaryphoneintlap"] = Row.mobilephone;
            }
            _orgService.Update(record);
            hasDulicate = true;
        }

        if (hasDulicate == false)
        {
            var contact = new Entity("new_lapinterpreter");

            if (!Row.fullname_IsNull)
            {
                contact["new_interpretername"] = Row.fullname;
            }

            if (!Row.newprimarylanguage_IsNull)
            {
                contact["new_interpreterlanguage"] = Row.newprimarylanguage;
            }

            if (!Row.emailaddress1_IsNull)
            {
                contact["new_emailintlap"] = Row.emailaddress1;
            }

            if (!Row.mobilephone_IsNull)
            {
                contact["new_primaryphoneintlap"] = Row.mobilephone;
            }


          _orgService.Create(contact);
        }
    }

Thanks


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>