<?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>Restricting duplicate drop-down rows in editable grid</title><link>https://community.appian.com/discussions/f/general/17306/restricting-duplicate-drop-down-rows-in-editable-grid</link><description>I have this requirement. 
 We have two columns in editable grid which are of drop-down fields.and we select one value in each column of first row and we add second row now and in this row we select same value that was given in the first row first column</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Restricting duplicate drop-down rows in editable grid</title><link>https://community.appian.com/thread/68216?ContentTypeID=1</link><pubDate>Wed, 17 Jul 2019 16:08:55 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a1553c2d-afe4-4e45-ae7a-2c73cab6ac4b</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Here&amp;#39;s the example solution I&amp;#39;ve prepared for you - it uses a slightly simplified version of your Categories/Segments grid (for example purposes) and assumes that Segments are children of Categories but have unique Segment IDs.&amp;nbsp; I use a!forEach over the array of possible Segment choices, in the context of a single grid row, to check whether that Segment has already been selected in another row, in which case it&amp;#39;s excluded from the dropdown list.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;BTW, this code uses the 19.2 variable definitions, if you&amp;#39;re still pre-19.2 then you will need to adjust it to remove a!localVariables() and add load() and with() statements.&lt;/p&gt;
&lt;p&gt;&lt;img height="106" src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/11/pastedimage1563379755879v1.png" width="381" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="java"&gt;a!localVariables(
  local!enableDebug: a!refreshVariable(
    value: false(),
    refreshAlways: true()
  ),
  local!categories: {
    {
      categoryId: 1,
      categoryName: &amp;quot;Firm&amp;quot;,
      segments: {
        {
          segmentId: 1,
          segmentName: &amp;quot;Global Credit&amp;quot;
        },
        {
          segmentId: 2,
          segmentName: &amp;quot;Local Credit&amp;quot;
        }
      }
    },
    {
      categoryId: 2,
      categoryName: &amp;quot;Practice&amp;quot;,
      segments: {
        {
          segmentId: 3,
          segmentName: &amp;quot;Practice 1&amp;quot;
        },
        {
          segmentId: 4,
          segmentName: &amp;quot;Practice 2&amp;quot;
        }
      }
    }
  },
  
  
  local!rowData: {
    {
      selectedCategory: null(),
      selectedSegment: null()
    }
  },
  
  
  a!sectionLayout(
    label: &amp;quot;Let&amp;#39;s try this&amp;quot;,
    contents: {
      a!gridLayout(
        headerCells: {
          a!gridLayoutHeaderCell(label: &amp;quot;Category&amp;quot;),
          a!gridLayoutHeaderCell(label: &amp;quot;Segment&amp;quot;),
          a!gridLayoutHeaderCell(label: &amp;quot;DEBUG&amp;quot;, showWhen: local!enableDebug)
        },
        rows: a!forEach(
          local!rowData,

          a!localVariables(
            local!currentRowData: fv!item,
            local!currentSegments: if(
              isnull(local!currentRowData.selectedCategory),
              {},
              index(
                local!categories.segments,
                where( local!categories.categoryId = local!currentRowData.selectedCategory ),
                {}
              )[1]
            ),
            local!availableSegments: a!forEach(
              local!currentSegments,
              if(
                and(
                  tointeger(local!currentRowData.selectedSegment) &amp;lt;&amp;gt; tointeger(fv!item.segmentId),
                  contains(
                    local!rowData.selectedSegment, /* assumes all Segment IDs are unique across Categories */
                    fv!item.segmentId
                  )
                ),
                {},
                fv!item
              )
            ),
            a!gridRowLayout(
              id: fv!index,
              contents: {
                a!dropdownField(
                  label: &amp;quot;Category Dropdown&amp;quot;,
                  choiceLabels: local!categories.categoryName,
                  choiceValues: local!categories.categoryId,
                  placeholderLabel: &amp;quot;Choose Category&amp;quot;,
                  value: fv!item.selectedCategory,
                  saveInto: {
                    a!save(
                      fv!item.selectedSegment,
                      if(
                        save!value &amp;lt;&amp;gt; fv!item.selectedSegment,
                        null(),
                        fv!item.selectedSegment
                      )
                    ),
                    fv!item.selectedCategory
                  }
                ),
                if(
                  isnull(fv!item.selectedCategory),
                  a!textField(
                    disabled: true(),
                    value: &amp;quot;(select a category first)&amp;quot;
                  ),
                  a!dropdownField(
                    label: &amp;quot;Segment Dropdown&amp;quot;,
                    choiceLabels: property(local!availableSegments, &amp;quot;segmentName&amp;quot;, {}),
                    choiceValues: property(local!availableSegments, &amp;quot;segmentId&amp;quot;, {}),
                    placeholderLabel: &amp;quot;Choose Segment&amp;quot;,
                    value: fv!item.selectedSegment,
                    saveInto: {
                      fv!item.selectedSegment
                    }
                  )
                ),

                a!paragraphField(
                  label: &amp;quot;DEBUG&amp;quot;,
                  showWhen: local!enableDebug,
                  height: &amp;quot;TALL&amp;quot;,
                  
                  value: a!forEach(
                    local!currentSegments,
                    fv!item.segmentId
                  ),
                  readOnly: true()
                )
              }
            )
          )
        ),
        
        addRowLink: a!dynamicLink(
          label: &amp;quot;Add Row&amp;quot;,
          saveInto: {
            a!save(
              local!rowData,
              append(
                local!rowData,
                {
                  selectedCategory: null(),
                  selectedSegment: null()
                }
              )
            )
          }
        )
      )
    }
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restricting duplicate drop-down rows in editable grid</title><link>https://community.appian.com/thread/68212?ContentTypeID=1</link><pubDate>Wed, 17 Jul 2019 14:24:42 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ae614715-0dca-4872-aa1a-868728e18460</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;We could use a little more info about the nature of exactly how the different data sets (i.e. category, sub category, segment, etc) are tied together, in order to formulate a meaningful suggestion.&amp;nbsp; Meanwhile I&amp;#39;m working on one that uses my first assumptions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restricting duplicate drop-down rows in editable grid</title><link>https://community.appian.com/thread/68211?ContentTypeID=1</link><pubDate>Wed, 17 Jul 2019 13:51:34 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f64cc9f4-ffa4-41bc-b915-c88d31516d25</guid><dc:creator>davel001150</dc:creator><description>&lt;p&gt;The way I&amp;#39;m thinking I would solve this problem is to have 2 copies of the same array of choice Labels and choice Values, then remove() from both lists for the second set at the index of the one chosen from the first set.&lt;/p&gt;
&lt;p&gt;{1, 2, 3} {Choice 1, Choice 2, Choice 3}&amp;nbsp; User selects choice 2,&lt;/p&gt;
&lt;p&gt;remove(local!choiceValues2, whereContains(local!choiceLabels1, &amp;quot;choice 2&amp;quot;))&lt;/p&gt;
&lt;p&gt;&lt;span&gt;remove(local!choiceLabels2, whereContains(local!choice&lt;/span&gt;&lt;span&gt;Labels&lt;/span&gt;&lt;span&gt;1, &amp;quot;choice 2&amp;quot;))&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;It would probably be best to leave the second one disabled until you&amp;#39;ve made a selection from the first one, and disable the first one after you&amp;#39;ve made a selection in the second one, or reset the second dropdown choice to null every time you change the first, otherwise you&amp;#39;ll find yourself making a pink box every time you remove the one you have currently selected from the list.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restricting duplicate drop-down rows in editable grid</title><link>https://community.appian.com/thread/68208?ContentTypeID=1</link><pubDate>Wed, 17 Jul 2019 06:07:53 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5e0fdb3f-5489-48cd-867b-d9a8c76a6076</guid><dc:creator>mpatram</dc:creator><description>&lt;p&gt;I hope you already set the choice value &amp;amp; choice options in your drop down. If yes, you&amp;#39;ll get all those options for the new row.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restricting duplicate drop-down rows in editable grid</title><link>https://community.appian.com/thread/68206?ContentTypeID=1</link><pubDate>Wed, 17 Jul 2019 06:00:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:225abcc5-61e7-48b6-9450-513d489adf5e</guid><dc:creator>phanys0001</dc:creator><description>&lt;p&gt;but we should be able to select other values in the segment column other than the duplicate values.is that posssible if we set the fields as blank?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restricting duplicate drop-down rows in editable grid</title><link>https://community.appian.com/thread/68205?ContentTypeID=1</link><pubDate>Wed, 17 Jul 2019 05:55:16 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:26d76567-f82b-40e6-9659-236aa010369c</guid><dc:creator>mpatram</dc:creator><description>&lt;p&gt;try this code.....&lt;/p&gt;
&lt;p&gt;addRowLink: a!dynamicLink(&lt;br /&gt; label: &amp;quot;Add Line&amp;quot;,&lt;br /&gt; saveInto: {&lt;br /&gt; a!save(&lt;br /&gt; ri!yourArray,&lt;br /&gt; append(ri!yourArray,&lt;br /&gt; {&lt;br /&gt; id: null,&lt;br /&gt; category: &amp;quot;&amp;quot;,&lt;br /&gt; subCategory: &amp;quot;&amp;quot;,&lt;br /&gt; segment: &amp;quot;&amp;quot;,&lt;br /&gt; subSegment: &amp;quot;&amp;quot;&lt;br /&gt; }&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; }&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restricting duplicate drop-down rows in editable grid</title><link>https://community.appian.com/thread/68204?ContentTypeID=1</link><pubDate>Wed, 17 Jul 2019 05:47:33 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a1e90e73-f5b4-4926-97bf-9c52b7c0ea28</guid><dc:creator>mpatram</dc:creator><description>&lt;p&gt;set the fields as blank under &amp;quot;Add Line&amp;quot; dynamic link&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restricting duplicate drop-down rows in editable grid</title><link>https://community.appian.com/thread/68203?ContentTypeID=1</link><pubDate>Wed, 17 Jul 2019 05:45:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:47f006cb-5e7e-478d-825f-f6d3c1872973</guid><dc:creator>phanys0001</dc:creator><description>&lt;p&gt;&lt;img alt="while values of category are same we should not allow the same values in the segment  " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/11/Screenshot-_2800_13_2900_.png" /&gt;while category values are same we should not allow the same values in segment drop-down&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restricting duplicate drop-down rows in editable grid</title><link>https://community.appian.com/thread/68202?ContentTypeID=1</link><pubDate>Wed, 17 Jul 2019 05:39:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3f63275a-1b08-41b4-b4f4-914a8d6a5244</guid><dc:creator>mpatram</dc:creator><description>&lt;p&gt;I am facing the same issue for radio button,...any leads pls share.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>