<?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>Get duplicates from array</title><link>https://community.appian.com/discussions/f/rules/29585/get-duplicates-from-array</link><description>How to get the duplicates from an array: 
 i/p:{1,2,2,3,3} o/p:{2,3}</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Get duplicates from array</title><link>https://community.appian.com/thread/117395?ContentTypeID=1</link><pubDate>Tue, 08 Aug 2023 15:11:13 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e9ea8a3d-8810-4c29-9712-a7a14f62ebf4</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;Note this last example will need a union() on the local!output as it duplicates values with more than 2 occurrences.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Get duplicates from array</title><link>https://community.appian.com/thread/117394?ContentTypeID=1</link><pubDate>Tue, 08 Aug 2023 14:48:42 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8780ac9d-5408-40e4-a117-42445fa5e92c</guid><dc:creator>jamesm4933</dc:creator><description>&lt;p&gt;Don&amp;#39;t use, but it may be of interest:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!input: { 1, 2, 2, 3, 3 },
  local!output: index(local!input, where(a!forEach(local!input, fv!index&amp;gt;wherecontains(fv!item, local!input)[1]))),
  local!output
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Get duplicates from array</title><link>https://community.appian.com/thread/117393?ContentTypeID=1</link><pubDate>Tue, 08 Aug 2023 14:41:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6892d30d-a45e-4ca8-8d87-b4c0ea458300</guid><dc:creator>jamesm4933</dc:creator><description>&lt;p&gt;This seems to work, too.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!input: { 1, 2, 2, 3, 3 },
  local!output: index(local!input, a!forEach(union(local!input, local!input), index(wherecontains(fv!item, local!input), 2, {}))),
  local!output
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Get duplicates from array</title><link>https://community.appian.com/thread/117363?ContentTypeID=1</link><pubDate>Tue, 08 Aug 2023 07:16:13 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8b245919-1241-4013-9528-e4c196c055f8</guid><dc:creator>Harshitha Mangamuri</dc:creator><description>&lt;p&gt;Hi, Please try to use this&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!a:{1,2,2,3,3},
  a!flatten(a!forEach(
    items: union(local!a,local!a),
    expression: if(
      length(wherecontains(fv!item,local!a))&amp;gt;1,
      fv!item,
      {}
    )
  ))
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>