<?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>Compare and get a count of expression</title><link>https://community.appian.com/discussions/f/data/18032/compare-and-get-a-count-of-expression</link><description>Hello , 
 I have two expression rules, rule 1 &amp;amp; rule 2. I want to compare them and print its count into grid. 
 RULE 1 
 
 ABC 
 CDE 
 GHI 
 JKL 
 
 RULE 2 
 ABC 
 DEF 
 ABC 
 DEF 
 GHI 
 ABC 
 
 I want to compare rule 1 with rule 2 and count of match</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Compare and get a count of expression</title><link>https://community.appian.com/thread/70936?ContentTypeID=1</link><pubDate>Wed, 11 Dec 2019 06:20:10 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7fde9601-1754-4419-a8f8-f15713dee346</guid><dc:creator>Kandarp Pandya</dc:creator><description>&lt;p&gt;Hi It seems that you are using older version of Appian (As you have used a!gridTextColumn() in your modified code).&lt;/p&gt;
&lt;p&gt;Please try with below code. It should work.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;load(
  local!pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: 10
  ),
  local!rule1: {
    &amp;quot;ABC&amp;quot;,
    &amp;quot;CDE&amp;quot;,
    &amp;quot;GHI&amp;quot;,
    &amp;quot;JKL&amp;quot;,
    
  },
  local!rule2: {
    &amp;quot;ABC&amp;quot;,
    &amp;quot;DEF&amp;quot;,
    &amp;quot;ABC&amp;quot;,
    &amp;quot;DEF&amp;quot;,
    &amp;quot;GHI&amp;quot;,
    &amp;quot;ABC&amp;quot;
  },
  local!data: a!forEach(
    items: local!rule1,
    expression: {
      value: fv!item,
      count: count(
        wherecontains(
          fv!item,
          local!rule2
        )
      )
    }
  ),
  with(
    local!dataSubSet: todatasubset(
      local!data,
      local!pagingInfo
    ),
    a!gridField(
      label: &amp;quot;&amp;quot;,
      totalCount: local!dataSubSet.totalCount,
      columns: {
        a!gridTextColumn(
          label: &amp;quot;Value&amp;quot;,
          data: index(
            local!dataSubSet.data,
            &amp;quot;value&amp;quot;,
            {}
          )
        ),
        a!gridTextColumn(
          label: &amp;quot;Count&amp;quot;,
          data: index(
            local!dataSubSet.data,
            &amp;quot;count&amp;quot;,
            {}
          )
        )
      },
      value: local!pagingInfo,
      saveInto: local!pagingInfo
    )
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Compare and get a count of expression</title><link>https://community.appian.com/thread/70935?ContentTypeID=1</link><pubDate>Wed, 11 Dec 2019 05:50:28 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a6a5b9a5-9419-406c-8ab4-d78ba25daed1</guid><dc:creator>gauravp0003</dc:creator><description>&lt;p&gt;I modified the code as below but grid is showing empty.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;load(&lt;br /&gt; local!pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 10),&lt;br /&gt; local!rule1: {&lt;br /&gt; &amp;quot;ABC&amp;quot;,&lt;br /&gt; &amp;quot;CDE&amp;quot;,&lt;br /&gt; &amp;quot;GHI&amp;quot;,&lt;br /&gt; &amp;quot;JKL&amp;quot;,&lt;br /&gt; &lt;br /&gt; },&lt;br /&gt; local!rule2: {&lt;br /&gt; &amp;quot;ABC&amp;quot;,&lt;br /&gt; &amp;quot;DEF&amp;quot;,&lt;br /&gt; &amp;quot;ABC&amp;quot;,&lt;br /&gt; &amp;quot;DEF&amp;quot;,&lt;br /&gt; &amp;quot;GHI&amp;quot;,&lt;br /&gt; &amp;quot;ABC&amp;quot;&lt;br /&gt; },&lt;br /&gt; local!data: a!forEach(&lt;br /&gt; items: local!rule1,&lt;br /&gt; expression: {&lt;br /&gt; value: fv!item,&lt;br /&gt; count: count(&lt;br /&gt; wherecontains(&lt;br /&gt; fv!item,&lt;br /&gt; local!rule2&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; }&lt;br /&gt;),&lt;br /&gt;a!gridField(&lt;br /&gt; label: &amp;quot;&amp;quot;,&lt;br /&gt; totalCount: 10,&lt;br /&gt; columns: {&lt;br /&gt; a!gridTextColumn(&lt;br /&gt; label: &amp;quot;Value&amp;quot;,&lt;br /&gt; value: fv!row.value&lt;br /&gt; ),&lt;br /&gt; a!gridTextColumn(&lt;br /&gt; label: &amp;quot;Count&amp;quot;,&lt;br /&gt; value: fv!row.count&lt;br /&gt; )&lt;br /&gt; },&lt;br /&gt; value: local!pagingInfo,&lt;br /&gt; saveInto: local!pagingInfo&lt;br /&gt; )&lt;br /&gt;)&lt;/p&gt;
&lt;div class="PagingGridLayout---scrollable_content"&gt;
&lt;table class="PagingGridLayout---table PagingGridLayout---scrollable PagingGridLayout---striped"&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th class="PagingGridLayout---align_start" id="cdb65897ecc07f807ff1798545c4e8c4_headerCell_0" abbr="Value" scope="col"&gt;
&lt;div id="cdb65897ecc07f807ff1798545c4e8c4_column0_header"&gt;Value&lt;/div&gt;
&lt;/th&gt;
&lt;th class="PagingGridLayout---align_start" id="cdb65897ecc07f807ff1798545c4e8c4_headerCell_1" abbr="Count" scope="col"&gt;
&lt;div id="cdb65897ecc07f807ff1798545c4e8c4_column1_header"&gt;Count&lt;/div&gt;
&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class="PagingGridLayout---empty_msg"&gt;
&lt;td colspan="2"&gt;No items available&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;div class="GridFooter---grid_footer"&gt;
&lt;div class="GridFooter---grid_footer_columns"&gt;
&lt;div class="GridFooter---align_end"&gt;&lt;span class="GridFooter---count"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Compare and get a count of expression</title><link>https://community.appian.com/thread/70931?ContentTypeID=1</link><pubDate>Wed, 11 Dec 2019 05:17:37 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8e642b62-4015-44dd-937f-24b2a9d50050</guid><dc:creator>gauravp0003</dc:creator><description>&lt;p&gt;Thanks, getting below error. I am on 17.4&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong class="StrongText---richtext_strong StrongText---inMessageLayout StrongText---error"&gt;Could not display interface. Please check definition and inputs.&lt;/strong&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;Interface Definition: Expression evaluation error at function a!gridColumn [line 33]: Invalid function a!gridLayoutColumns&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Compare and get a count of expression</title><link>https://community.appian.com/thread/70907?ContentTypeID=1</link><pubDate>Tue, 10 Dec 2019 14:16:56 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4e7b0cef-5d58-4c28-ac0f-7daeb67cde55</guid><dc:creator>Krishna Chaitanya Mallavarapu</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;load(
  local!rule1: {
    &amp;quot;ABC&amp;quot;,
    &amp;quot;CDE&amp;quot;,
    &amp;quot;GHI&amp;quot;,
    &amp;quot;JKL&amp;quot;,
    
  },
  local!rule2: {
    &amp;quot;ABC&amp;quot;,
    &amp;quot;DEF&amp;quot;,
    &amp;quot;ABC&amp;quot;,
    &amp;quot;DEF&amp;quot;,
    &amp;quot;GHI&amp;quot;,
    &amp;quot;ABC&amp;quot;
  },
  local!data: a!forEach(
    items: local!rule1,
    expression: {
      value: fv!item,
      count: count(
        wherecontains(
          fv!item,
          local!rule2
        )
      )
    }
  ),
  a!gridField(
    label: &amp;quot;&amp;quot;,
    data: local!data,
    columns: {
      a!gridColumn(
        label: &amp;quot;Value&amp;quot;,
        value: fv!row.value
      ),
      a!gridColumn(
        label: &amp;quot;Count&amp;quot;,
        value: fv!row.count
      )
    }
  )
)&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>