<?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>Comparing the elements of two strings in Appian</title><link>https://community.appian.com/discussions/f/general/18922/comparing-the-elements-of-two-strings-in-appian</link><description>Well, 
 I want to compare the elements of two Arrays in Appian. I have the image in my mind, but i can&amp;#39;t do it in Appian. 
 
 The example is like this: 
 We have 2 Arrays: 
 
 Array1: {100,200,300,400,700} 
 Array2: {100, 100, 300, 500,700} 
 
 The return</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Comparing the elements of two strings in Appian</title><link>https://community.appian.com/thread/74353?ContentTypeID=1</link><pubDate>Tue, 26 May 2020 11:30:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2ad7d60c-086e-46a2-8714-7d23e44fc670</guid><dc:creator>gdengrar</dc:creator><description>&lt;p&gt;I think second option it&amp;#39;s exactly what I deserve, thank you so much!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Comparing the elements of two strings in Appian</title><link>https://community.appian.com/thread/74352?ContentTypeID=1</link><pubDate>Tue, 26 May 2020 11:27:25 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c2c3b74a-5318-4d2a-9f84-712fe98dc75b</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;Or...if you want to compare every item in Array1 with every item in Array2:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!Array1: {100,200,300,400,700},
  local!Array2: {100, 100, 300, 500,700},
  a!forEach(
    items: local!Array1,
    expression: with(
      local!currentValue: fv!item,
      a!forEach(
        items: local!Array2,
        expression: fv!item=local!currentValue
      )
    )
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Comparing the elements of two strings in Appian</title><link>https://community.appian.com/thread/74351?ContentTypeID=1</link><pubDate>Tue, 26 May 2020 11:24:10 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a64051b6-e624-4795-8fb4-c9158bdf0b90</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;I&amp;#39;m not sure what you question is. But in case this is what you meant...here&amp;#39;s another solution:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!Array1: {100,200,300,400,700},
  local!Array2: {100, 100, 300, 500,700},
  a!forEach(
    items: local!Array1,
    expression: fv!item=local!Array2[fv!index]
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Comparing the elements of two strings in Appian</title><link>https://community.appian.com/thread/74350?ContentTypeID=1</link><pubDate>Tue, 26 May 2020 11:15:54 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:06ec5ba2-527c-4b18-944e-b2f0a2107126</guid><dc:creator>gdengrar</dc:creator><description>&lt;p&gt;It works!! but With forEach it can&amp;#39;t be do it??&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Comparing the elements of two strings in Appian</title><link>https://community.appian.com/thread/74349?ContentTypeID=1</link><pubDate>Tue, 26 May 2020 10:53:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e65df7cf-3187-4ccb-80c1-a15efb91488f</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;Hey - try this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!Array1: {100,200,300,400,700},
  local!Array2: {100, 100, 300, 500,700},
  a!forEach(
    items: fn!merge(local!Array1,local!Array2),
    expression: fv!item[1]=fv!item[2]
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The key to this is to use the merge() function which creates a list of lists (that is, it takes the first item in your first &lt;span&gt;array&amp;nbsp;&lt;/span&gt;and pairs it with the first item in your second array, and then the second with the second...and so forth)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>