<?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>Count distinct elements in an array</title><link>https://community.appian.com/discussions/f/user-interface/24362/count-distinct-elements-in-an-array</link><description>I have a requirement where I have to find the distinct value in the grid column and display it 
 
 Any suggestion</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Count distinct elements in an array</title><link>https://community.appian.com/thread/94012?ContentTypeID=1</link><pubDate>Fri, 22 Apr 2022 12:15:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d6f4ba30-4ea6-4a8a-9874-dc646f4b38b3</guid><dc:creator>ajhick</dc:creator><description>&lt;p&gt;Give this a go.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!values: {1,2,5,33,8,6,4,3,4,5,32,3,4,33,2,45,6,7,89,0,87,6,45,6345,35,6534,35,65,43,1,3,4,2},
  local!distinctValues: union(
    local!values,
    local!values
  ),
  local!countOfDistinctValues: if(
    a!isNullOrEmpty(local!distinctValues),
    0,
    length(local!distinctValues)
  ),
  {
    values: local!values,
    distinctValues: local!distinctValues,
    countOfDistinctValues: local!countOfDistinctValues
  }
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Count distinct elements in an array</title><link>https://community.appian.com/thread/94011?ContentTypeID=1</link><pubDate>Fri, 22 Apr 2022 12:12:09 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ae076010-9d6e-4ceb-bba2-51d7e71925a9</guid><dc:creator>Harshit Bumb (Appyzie)</dc:creator><description>&lt;p&gt;union() the array by itself and then use the count() function&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>