<?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>How to compare two array</title><link>https://community.appian.com/discussions/f/data/18196/how-to-compare-two-array</link><description>Hi all 
 I am getting data from excel sheet and i need to validate that data that is present in the existing table or not 
 If the particular data is not present or if there is any spelling mistake we have to throw an error of that particular word 
 For</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to compare two array</title><link>https://community.appian.com/thread/71640?ContentTypeID=1</link><pubDate>Mon, 27 Jan 2020 14:46:39 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e8d8c581-00aa-457f-9d41-5de77247e209</guid><dc:creator>nikkheel</dc:creator><description>&lt;p&gt;Thank you its working&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to compare two array</title><link>https://community.appian.com/thread/71626?ContentTypeID=1</link><pubDate>Sun, 26 Jan 2020 19:21:41 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5fc8bc0b-6521-48e7-915f-0381b6348042</guid><dc:creator>Sushma Rathnaiah</dc:creator><description>&lt;p&gt;Hi Nikkheel,&lt;/p&gt;
&lt;p&gt;You can use simple built in Appian function.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;difference({&amp;quot;india&amp;quot;, &amp;quot;usa&amp;quot;, &amp;quot;Australi&amp;quot;}, {&amp;quot;india&amp;quot;, &amp;quot;usa&amp;quot;, &amp;quot;Australia&amp;quot;,&amp;quot;uk&amp;quot;})&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to compare two array</title><link>https://community.appian.com/thread/71565?ContentTypeID=1</link><pubDate>Wed, 22 Jan 2020 10:28:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3d3ade5d-5185-480f-a4ed-38a866a588af</guid><dc:creator>Krishna Chaitanya Mallavarapu</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!referenceTableData: {
    &amp;quot;india&amp;quot;,
    &amp;quot;usa&amp;quot;,
    &amp;quot;Australia&amp;quot;,
    &amp;quot;uk&amp;quot;
  },
  local!excelData: {
    &amp;quot;india&amp;quot;,
    &amp;quot;usa&amp;quot;,
    &amp;quot;Australi&amp;quot;,
    &amp;quot;Iran&amp;quot;
  },
  local!notPresentList: a!forEach(
    items: local!excelData,
    expression: if(
      contains(
        local!referenceTableData,
        fv!item
      ),
      {},
      fv!item
    )
  ),
  concat(
    a!forEach(
      items: local!notPresentList,
      expression: if(
        fv!isLast,
        fv!item,
        concat(
          fv!item,
          &amp;quot;,&amp;quot;
        )
      )
    ),
    &amp;quot; is not present in data&amp;quot;
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to compare two array</title><link>https://community.appian.com/thread/71549?ContentTypeID=1</link><pubDate>Tue, 21 Jan 2020 13:29:37 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:118de696-5aa6-4e32-bc44-eb38d6f2776f</guid><dc:creator>kunals0003</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!checkExcelItemsInRefTable: a!forEach(
    items: ri!excelArray,
    expression: contains(
      {
        ri!refTablearray
      },
      fv!item
    )
  ),
  /*Match each index of array to return a boolean array if match was found or not*/
  local!notFoundIndexes: wherecontains(
    false,
    local!checkExcelItemsInRefTable
  ),
  /*Indexes from excel array where the match wasn&amp;#39;t found*/
  concat(
    joinarray(
      index(
        ri!excelArray,
        {
          local!notFoundIndexes
        },
        {}
      ),
      &amp;quot;, &amp;quot;
    ),
    &amp;quot; not found in reference table&amp;quot;
  )/*Returning the message with the values not found in reference table*/
  
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Use a code like this to compare arrays and get the following result.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/16/compareArray.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Hope it helps!&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Kunal&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>