防止在其他阵列角度js中推送阵列

时间:2018-03-23 11:14:56

标签: javascript angularjs

我有一个如下所示的数组,

                    $scope.unassociatedResults = [{
                                matchName : 'Dummy_data',
                                address : 'Dummy_data',
                                country : 'Dummy_data',
                                listSourceCountryName : 'Dummy_data',
                                screeningCategory : 'Dummy_data'
                    },
                    {
                                matchName : 'Dummy_data2',
                                address : 'Dummy_data2',
                                country : 'Dummy_data2',
                                listSourceCountryName : 'Dummy_data2',
                                screeningCategory : 'Dummy_data2'
                    },
                   {
                                matchName : 'Dummy_data3',
                                address : 'Dummy_data3',
                                country : 'Dummy_data3',
                                listSourceCountryName : 'Dummy_data3',
                                screeningCategory : 'Dummy_data3'
                    },
                    {
                                matchName : 'Dummy_data4',
                                address : 'Dummy_data4',
                                country : 'Dummy_data4',
                                listSourceCountryName : 'Dummy_data4',
                                screeningCategory : 'Dummy_data4'
                    },
            ];

现在,我有其他数组,其中包含如下参数

           $scope.unassociatedResultsNewArray = [{
                            matchName : 'Dummy_data',
                            address : 'Dummy_data',
                            country : 'Dummy_data',
                            listSourceCountryName : 'Dummy_data',
                            screeningCategory : 'Dummy_data'
                }];

如何检查新数组的至少两个,三个值到现有数组列表,或者如何将整个新数组与现有数组列表进行比较,以避免重复。在我的情况下,我没有id或没有主要的东西喜欢检查或比较数据。所以我需要用现有的数组列表检查整个数组。

如何在angularjs或javascript中查看?

1 个答案:

答案 0 :(得分:1)

试试这个。

string CaseLocalId = null;

using (OracleConnection conn = new OracleConnection(ConfigurationManager.ConnectionStrings["asd"].ConnectionString))
{
    conn.Open();

    OracleCommand cmd = new OracleCommand
    {
        Connection = conn,
        Parameters =
        {
            // CaseLocalId
            new OracleParameter
            {
                ParameterName = "CaseLocalId",
                OracleDbType = OracleDbType.Varchar2,
                IsNullable = true,
                Value = CaseLocalId,
            }
        },
        CommandText = $@"
                select c.case_local_id, c.title, c.description
                from asd.CC_CASE_TASK t, asd.CC_CASE c
                where c.case_local_id = t.case_local_id(+)
                and c.case_local_id like nvl(':CaseLocalId','%') -- doesn't work
                -- and c.case_local_id like nvl('{CaseLocalId}','%') -- this works
                ",
        CommandType = CommandType.Text,                        
    };
}