<?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>Remove duplicate values in grid</title><link>https://community.appian.com/discussions/f/user-interface/21439/remove-duplicate-values-in-grid</link><description>Hi All, 
 
 I have requirement where I need to remove consequent duplicate value while showing the data in grid. 
 i,e if values are: {&amp;quot;Requested&amp;quot;, &amp;quot;Requested&amp;quot;, &amp;quot;Pending&amp;quot;,&amp;quot;Sent For Approval&amp;quot;,&amp;quot;Approved&amp;quot;,&amp;quot;Pending&amp;quot;,&amp;quot;Approved&amp;quot;,&amp;quot;Approved&amp;quot;} the expected output</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Remove duplicate values in grid</title><link>https://community.appian.com/thread/83749?ContentTypeID=1</link><pubDate>Fri, 16 Jul 2021 09:56:16 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ef1a4e01-3dc1-4d90-9374-75e58dc272f6</guid><dc:creator>GauravSingh</dc:creator><description>&lt;p&gt;Thanks Mike,&lt;/p&gt;
&lt;p&gt;This really helped with small variation as I was using one cdt where two fields needs to be considered together.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
local!RequestHistory:###Query From DB###,
local!uniqueHistoryData:a!forEach(
    local!colocationRequestHistory,
    if(
      fv!isFirst,
      fv!item,
      if(
        and(
        fv!item.statusExternal = local!RequestHistory.statusExternal[fv!index - 1],
        fv!item.stage = local!RequestHistory.stage[fv!index - 1],
        ),
        {},
        fv!item
      )
    )
  ),
  local!uniqueHistoryData
  )&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Remove duplicate values in grid</title><link>https://community.appian.com/thread/83726?ContentTypeID=1</link><pubDate>Thu, 15 Jul 2021 14:24:03 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:312afe53-1a88-42cf-9261-73a2b4b2f24e</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Pretty sure a!forEach() can handle this implicitly, without needing to involve legacy looping functions or helper rules.&amp;nbsp; E.G.:&lt;br /&gt;&lt;pre class="ui-code" data-mode="java"&gt;a!localVariables(
  local!values: {&amp;quot;Requested&amp;quot;, &amp;quot;Requested&amp;quot;, &amp;quot;Pending&amp;quot;, &amp;quot;Sent For Approval&amp;quot;, &amp;quot;Approved&amp;quot;, &amp;quot;Pending&amp;quot;, &amp;quot;Approved&amp;quot;, &amp;quot;Approved&amp;quot;},
  
  a!forEach(
    local!values,
    if(
      fv!isFirst,
      fv!item,
      if(
        fv!item = local!values[fv!index - 1],
        {},
        fv!item
      )
    )
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Result:&lt;br /&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/13/pastedimage1626358902849v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Note that this would collapse *all* consecutively repeated values, not just cases where there are 2 repeated items.&amp;nbsp; Though it sounds like this satisfies OP&amp;#39;s use case anyway.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Remove duplicate values in grid</title><link>https://community.appian.com/thread/83711?ContentTypeID=1</link><pubDate>Thu, 15 Jul 2021 08:03:03 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:51320415-97c9-479d-84bb-540b64394186</guid><dc:creator>Madhusudan Sharma</dc:creator><description>&lt;p&gt;Try this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!list: {
    &amp;quot;Requested&amp;quot;,
    &amp;quot;Requested&amp;quot;,
    &amp;quot;Pending&amp;quot;,
    &amp;quot;Sent For Approval&amp;quot;,
    &amp;quot;Approved&amp;quot;,
    &amp;quot;Pending&amp;quot;,
    &amp;quot;Approved&amp;quot;,
    &amp;quot;Approved&amp;quot;
  },
  local!newList: reject(
    fn!isnull,
    a!forEach(
      items: local!list,
      expression: if(
        or(
          fv!index = 1,
          local!list[fv!index - 1] &amp;lt;&amp;gt; fv!item
        ),
        fv!item,
        null
      )
    )
  ),
  local!newList
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Hope it helps.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Remove duplicate values in grid</title><link>https://community.appian.com/thread/83710?ContentTypeID=1</link><pubDate>Thu, 15 Jul 2021 07:15:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c2a6a881-803d-47b8-8695-cb17acc8e504</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;You use reduce() to do this. Requires a helper function. They idea is:&lt;/p&gt;
&lt;p&gt;If last item in list equals new value, skip it, else append it.&lt;/p&gt;
&lt;p&gt;MAIN&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!values: {&amp;quot;Requested&amp;quot;, &amp;quot;Requested&amp;quot;, &amp;quot;Pending&amp;quot;, &amp;quot;Sent For Approval&amp;quot;, &amp;quot;Approved&amp;quot;, &amp;quot;Pending&amp;quot;, &amp;quot;Approved&amp;quot;, &amp;quot;Approved&amp;quot;},
  reduce(
    rule!SSH_ReduceHelper(
      list:_,
      newValue:_
    ),
    {},
    local!values
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;HELPER: Inputs: list(Array of Text), newValue(Text)&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;if(
  index(reverse(ri!list), 1, &amp;quot;&amp;quot;) = ri!newValue,
  ri!list,
  append(ri!list, ri!newValue)
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Remove duplicate values in grid</title><link>https://community.appian.com/thread/83702?ContentTypeID=1</link><pubDate>Thu, 15 Jul 2021 06:10:24 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ef268a17-7327-4420-8abc-d5d87135c67c</guid><dc:creator>GauravSingh</dc:creator><description>&lt;p&gt;Hi Leela,&lt;/p&gt;
&lt;p&gt;Requirement is to remove two consecutive duplicates, not all duplicates&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;{&amp;quot;Requested&amp;quot;, &amp;quot;Requested&amp;quot;, &amp;quot;Pending&amp;quot;, &amp;quot;Sent For Approval&amp;quot;, &amp;quot;Approved&amp;quot;, &amp;quot;Pending&amp;quot;, &amp;quot;Approved&amp;quot;, &amp;quot;Approved&amp;quot;} the expected output is&amp;nbsp;&lt;/span&gt;&lt;span&gt;{&amp;quot;Requested&amp;quot;, &amp;quot;Pending&amp;quot;, &amp;quot;Sent For Approval&amp;quot;, &amp;quot;Approved&amp;quot;, &amp;quot;Pending&amp;quot;, &amp;quot;Approved&amp;quot;}&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Remove duplicate values in grid</title><link>https://community.appian.com/thread/83699?ContentTypeID=1</link><pubDate>Thu, 15 Jul 2021 06:05:29 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:59c94b32-bd20-4128-bb2b-0a3751fb7404</guid><dc:creator>Ram K</dc:creator><description>&lt;p&gt;Hi Gaurav,&lt;br /&gt;&lt;br /&gt;You can get unique list first and then pass that to Grid.&lt;br /&gt;&lt;br /&gt;EX:{1,2,3,4,1,4,5}&lt;br /&gt;&lt;br /&gt;try&lt;br /&gt;union(&lt;span&gt;{1,2,3,4,1,4,5},{1,2,3,4,1,4,5}&lt;/span&gt;) returns&amp;nbsp;&lt;span&gt;:{1,2,3,4,5}&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>