<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Comparison between two datasubsets</title><link>https://community.appian.com/discussions/f/data/17097/comparison-between-two-datasubsets</link><description>Hi, 
 Suppose I have two datasets &amp;quot;A&amp;quot; &amp;amp; &amp;quot;B&amp;quot;. I want to compare both datasets based on property_id and merged it into another variable called &amp;quot;C&amp;quot;. Conditions are as follow: 
 
 If the value of property_id appears in both the datasets are common then user_id</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Comparison between two datasubsets</title><link>https://community.appian.com/thread/67464?ContentTypeID=1</link><pubDate>Tue, 18 Jun 2019 12:58:40 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1faecf2c-67d5-4bc6-8471-3d4f772fbd45</guid><dc:creator>husaina0001</dc:creator><description>&lt;p&gt;Thanks Krishna!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Comparison between two datasubsets</title><link>https://community.appian.com/thread/67408?ContentTypeID=1</link><pubDate>Mon, 17 Jun 2019 12:35:24 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:80a6ea87-2049-4f6e-8d86-1a120502a6a7</guid><dc:creator>Krishna Chaitanya Mallavarapu</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;load(
  local!A: {
    {
      user_id: null,
      property_id: 2,
      active: true
    },
    {
      user_id: null,
      property_id: 4,
      active: true
    },
    {
      user_id: null,
      property_id: 7,
      active: true
    }
  },
  local!B: {
    {
      user_id: 100,
      property_id: 1,
      active: true
    },
    {
      user_id: 101,
      property_id: 2,
      active: true
    },
    {
      user_id: 102,
      property_id: 6,
      active: true
    }
  },
  {
    index(
      local!A,
      wherecontains(
        difference(
          local!A.property_id,
          local!B.property_id
        ),
        local!A.property_id
      ),
      null
    ),
    a!forEach(
      items: index(
        local!B,
        wherecontains(
          difference(
            local!B.property_id,
            local!A.property_id
          ),
          local!B.property_id
        ),
        null
      ),
      expression: {
        user_id: fv!item.user_id,
        property_id: fv!item.property_id,
        active: false()
      }
    ),
    a!forEach(
      items: index(
        local!B,
        wherecontains(
          intersection(
            local!B.property_id,
            local!A.property_id
          ),
          local!B.property_id
        ),
        null
      ),
      expression: {
        user_id: fv!item.user_id,
        property_id: fv!item.property_id,
        active: true()
      }
    )
  }
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>