<?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>Editable grid validation</title><link>https://community.appian.com/discussions/f/user-interface/25693/editable-grid-validation</link><description>I have to validate a editable grid for the following scenario - 
 I have two fields in the grid 1. Role 2. Location 
 use case - if the user select combination of same role and location as a duplicate then it should thrown an validation error like combination</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Editable grid validation</title><link>https://community.appian.com/thread/100493?ContentTypeID=1</link><pubDate>Mon, 05 Sep 2022 11:15:39 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f7dc1d85-517b-444f-b702-0be6416d129f</guid><dc:creator>Harshit Bumb (Appyzie)</dc:creator><description>&lt;p&gt;Oh yes. We do not need multiple whereContains(). Nice catch Ujjwal!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Editable grid validation</title><link>https://community.appian.com/thread/100492?ContentTypeID=1</link><pubDate>Mon, 05 Sep 2022 11:14:30 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f4a169a5-d2ce-49e5-a8b3-74326732ab1d</guid><dc:creator>ujjwalr0002</dc:creator><description>&lt;p&gt;I have much easier way.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!array: { { role: null, Location: null } },
  a!gridLayout(
    headerCells: {
      a!gridLayoutHeaderCell(label: &amp;quot;Role&amp;quot;),
      a!gridLayoutHeaderCell(label: &amp;quot;Location&amp;quot;)
    },
    rows: a!forEach(
      items: local!array,
      expression: a!gridRowLayout(
        contents: {
          a!dropdownFieldByIndex(
            choiceLabels: { &amp;quot;Abc&amp;quot;, &amp;quot;Def&amp;quot;, &amp;quot;Ghi&amp;quot; },
            validations: if(
              count(wherecontains(fv!item, local!array)) &amp;gt; 1,
              &amp;quot;Combination of role and location should be unique.&amp;quot;,
              {}
            ),
            value: fv!item.role,
            saveInto: local!array[fv!index].role,
            placeholder: &amp;quot;-&amp;quot;
          ),
          a!dropdownFieldByIndex(
            choiceLabels: { &amp;quot;L1&amp;quot;, &amp;quot;L2&amp;quot;, &amp;quot;L3&amp;quot; },
            validations: if(
              count(wherecontains(fv!item, local!array)) &amp;gt; 1,
              &amp;quot;Combination of role and location should be unique.&amp;quot;,
              {}
            ),
            value: fv!item.Location,
            saveInto: local!array[fv!index].Location,
            placeholder: &amp;quot;-&amp;quot;
          )
        }
      )
    ),
    addRowLink: a!dynamicLink(
      label: &amp;quot;Add&amp;quot;,
      value: append(local!array, { role: null, Location: null }),
      saveInto: local!array
    ),
    
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Editable grid validation</title><link>https://community.appian.com/thread/100489?ContentTypeID=1</link><pubDate>Mon, 05 Sep 2022 10:20:44 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e060c892-40a3-412f-9d53-746ceea8cc56</guid><dc:creator>udhayakumarm000856</dc:creator><description>&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Editable grid validation</title><link>https://community.appian.com/thread/100488?ContentTypeID=1</link><pubDate>Mon, 05 Sep 2022 10:20:15 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ce0f4122-40c5-4037-ae0e-39a3c481d80c</guid><dc:creator>udhayakumarm000856</dc:creator><description>&lt;p&gt;Thanks its worked&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Editable grid validation</title><link>https://community.appian.com/thread/100487?ContentTypeID=1</link><pubDate>Mon, 05 Sep 2022 09:47:35 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:fc2d158b-c1de-4c85-9869-255f3e801329</guid><dc:creator>Harshit Bumb (Appyzie)</dc:creator><description>&lt;p&gt;You can add the below piece of code as validation on both the dropdowns - Role and location.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;if(
  and(
    or(
      count(
        wherecontains(fv!item.role, local!array.role)
      ) &amp;gt; 1,
      count(
        wherecontains(fv!item.Location, local!array.Location)
      ) &amp;gt; 1
    ),
    wherecontains(fv!item.role, local!array.role) = wherecontains(fv!item.Location, local!array.Location)
  ),
  &amp;quot;Combination of role and location should be unique.&amp;quot;,
  {}
)&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Editable grid validation</title><link>https://community.appian.com/thread/100486?ContentTypeID=1</link><pubDate>Mon, 05 Sep 2022 09:44:37 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6618ca06-ea88-4977-aeb9-a1ccc7de6a67</guid><dc:creator>deepakg681722</dc:creator><description>&lt;p&gt;Please try this.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!data,
  a!gridLayout(
    headerCells: {
      a!gridLayoutHeaderCell(label: &amp;quot;Role&amp;quot;),
      a!gridLayoutHeaderCell(label: &amp;quot;Location&amp;quot;)
    },
    addRowLink: a!dynamicLink(
      label: &amp;quot;Add&amp;quot;,
      saveInto: {
        a!save(
          local!data,
          append(local!data, { role: &amp;quot;&amp;quot;, loc: &amp;quot;&amp;quot; })
        )
      }
    ),
    rows: a!forEach(
      items: local!data,
      expression: a!gridRowLayout(
        contents: {
          a!dropdownField(
            choiceLabels: { &amp;quot;Dev&amp;quot;, &amp;quot;Tester&amp;quot; },
            choiceValues: { &amp;quot;Dev&amp;quot;, &amp;quot;Tester&amp;quot; },
            placeholder: &amp;quot;---&amp;quot;,
            value: fv!item.role,
            saveInto: fv!item.role,
            validations: if(
              count(
                intersection(
                  wherecontains(
                    tostring(fv!item.role),
                    a!flatten(local!data.role)
                  ),
                  wherecontains(
                    tostring(fv!item.loc),
                    a!flatten(local!data.loc)
                  )
                )
              ) &amp;gt; 1,
              &amp;quot;combination of role and location already exits&amp;quot;,
              &amp;quot;&amp;quot;
            )
          ),
          a!dropdownField(
            choiceLabels: { &amp;quot;India&amp;quot;, &amp;quot;USA&amp;quot;, &amp;quot;AUS&amp;quot; },
            choiceValues: { &amp;quot;India&amp;quot;, &amp;quot;USA&amp;quot;, &amp;quot;AUS&amp;quot; },
            placeholder: &amp;quot;---&amp;quot;,
            value: fv!item.loc,
            saveInto: fv!item.loc,
            validations: if(
              count(
                intersection(
                  wherecontains(
                    tostring(fv!item.role),
                    a!flatten(local!data.role)
                  ),
                  wherecontains(
                    tostring(fv!item.loc),
                    a!flatten(local!data.loc)
                  )
                )
              ) &amp;gt; 1,
              &amp;quot;combination of role and location already exits&amp;quot;,
              &amp;quot;&amp;quot;
            )
          )
        }
      )
    )
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>