title: How to use contains to compare property value from one array to another array logic app expression?
body: <p>I have two arrays variables and values like below </p>
  
  <p>arraydata1 = </p>
  
  <pre><code>[
    {
      "id": "1",
      "name": "aaa"
    },
    {
      "id": "2",
      "name": "bbb"
    },
    {
      "id": "3",
      "name": "ccc"
    },
    {
      "id": "4",
      "name": "ddd"
    },
   {
      "id": "14",
      "name": "bbb"
    }
  ]
  </code></pre>
  
  <p>arraydata2 = </p>
  
  <pre><code>[
    {
      "id": "111",
      "tablename": "aaa"
    },
    {
      "id": "222",
      "tablename": "bbb"
    }
  ]
  </code></pre>
  
  <p>output -</p>
  
  <pre><code>[
         {
          "id": "1",
          "name": "aaa"
        },
        {
          "id": "2",
          "name": "bbb"
        },
       {
          "id": "14",
          "name": "bbb"
        },
      ]
  </code></pre>
  
  <p>using 2 foreach also i'm able to achieve this but it takes time to compare.</p>
  
  <p>also tried using taken a <code>for-each connector</code> and inside that used <code>contains</code> expression to compare <code>name and tablename</code> but for all values it is false.</p>
  
  <p><code>contains(variables('arraydata2'),items('For_each')?['tablename'])</code></p>
  
  <blockquote>
    <p>can we do it without using 2 foreach</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/RJ8bZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RJ8bZ.png" alt="enter image description here"></a></p>