<?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>How to append results in a grid</title><link>https://community.appian.com/discussions/f/user-interface/11038/how-to-append-results-in-a-grid</link><description>Hi everyone, 
 
 I am having trouble with a grid and would like to get any help possible. 
 I have a search field where a user can search for a location. 
 Once they hit search and the location is available, they are able to select it. 
 They are then</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to append results in a grid</title><link>https://community.appian.com/thread/48334?ContentTypeID=1</link><pubDate>Fri, 08 Sep 2017 12:40:33 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:12d620f0-3f2a-449e-8e73-4b54afd9f210</guid><dc:creator>Thenmozhi Mohanakrishnan</dc:creator><description>&lt;p&gt;You can add one more a!save to remove the selected values from first grid like below.&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;a!save(&lt;br /&gt; local!selectedLocations,&lt;br /&gt; append(&lt;br /&gt; local!selectedLocations,&lt;br /&gt; index(&lt;br /&gt; local!locationsData.data,&lt;br /&gt; whereContains(&lt;br /&gt; local!gridSelection.selected,&lt;br /&gt; local!locationsData.identifiers&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt;),&lt;/p&gt;
&lt;p&gt;a!save(&lt;br /&gt; local!allLocations,&lt;br /&gt;remove(&lt;br /&gt; local!allLocations,&lt;br /&gt; whereContains(&lt;br /&gt; local!gridSelection.selected,&lt;br /&gt; local!allLocationsData.identifiers&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt;)&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to append results in a grid</title><link>https://community.appian.com/thread/48321?ContentTypeID=1</link><pubDate>Thu, 07 Sep 2017 18:01:45 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:08a35b84-3ac4-470e-84c5-b0d4ed068b0c</guid><dc:creator>Mike Schmitt</dc:creator><description>This should be possible, assuming you&amp;#39;re using a query entity to construct your locationsData datasubset.  Assuming you have it saved as an external rule, pass in a new rule input called &amp;quot;excludeLocations&amp;quot; (text, mulitple), and inside the rule, add logical requirement that if anything gets passed in for &amp;quot;excludeLocations&amp;quot;, they will get excluded from the query results.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to append results in a grid</title><link>https://community.appian.com/thread/48319?ContentTypeID=1</link><pubDate>Thu, 07 Sep 2017 17:09:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d2573c02-5e59-43e4-9078-0faa70990fa7</guid><dc:creator>ck0220</dc:creator><description>Wow! That worked perfectly! Thank you. Am I allowed to ask a related question? I was wondering how I would be able to remove the selected locations from the first grid, so that they wouldn&amp;#39;t be able to be searched again. So if the user searched New once more (and chose New York and New Jersey the first time), the only option that shows up is New Delhi.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to append results in a grid</title><link>https://community.appian.com/thread/48316?ContentTypeID=1</link><pubDate>Thu, 07 Sep 2017 16:10:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:cb8b36b7-5903-43b4-8c2f-f2caace5eef4</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Based on this description, the code you posted earlier is pretty close. &amp;nbsp;I think it should just need a slightly more complicated structuring of your a!save, to include the append() operation so as to not overwrite previously saved data when you click &amp;quot;Add&amp;quot; for subsequent additions.&lt;/p&gt;
&lt;p&gt;Maybe something like:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!save(
  local!selectedLocations,
  append(
    local!selectedLocations,
    index(
      local!locationsData.data,
      whereContains(
        local!gridSelection.selected,
        local!locationsData.identifiers
      )
    )
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to append results in a grid</title><link>https://community.appian.com/thread/48315?ContentTypeID=1</link><pubDate>Thu, 07 Sep 2017 15:49:35 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e23955df-6643-476f-afde-9bd728ad0721</guid><dc:creator>sureshg57</dc:creator><description>hi chynnak,&lt;br /&gt;
&lt;br /&gt;
I think the problem in your code is you are replacing the datasubset variable in your a!save. In the example I have given you, you can see how the updated values are used to generate the datasubset variable as this is used as a with variable. &lt;br /&gt;
&lt;br /&gt;
If you save new values to the datasubset.data which you use in the grid, obviously it will remove all previous values and update with new values. So keep those separate have a separate load variable to save the selected values then use those to generate the datasubset which you can use in your grid.&lt;br /&gt;
&lt;br /&gt;
Regards&lt;br /&gt;
Suresh&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to append results in a grid</title><link>https://community.appian.com/thread/48314?ContentTypeID=1</link><pubDate>Thu, 07 Sep 2017 15:17:38 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:aeae21ab-3ba7-4cdb-b6c9-b71bd87605c1</guid><dc:creator>ck0220</dc:creator><description>Let&amp;#39;s say in the search bar, they type &amp;quot;New&amp;quot;. Once they hit search, the locations that come up would be something like New York, New Jersey, New Delhi, etc. They&amp;#39;re able to select as many locations as they please and then hit the &amp;quot;add&amp;quot; button.  This button adds the selected locations to a grid below it. The issue comes in when the user wants to now search something like &amp;quot;North&amp;quot;, all the &amp;quot;New&amp;quot; locations are now removed from the grid.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to append results in a grid</title><link>https://community.appian.com/thread/48313?ContentTypeID=1</link><pubDate>Thu, 07 Sep 2017 15:05:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0676b577-aad1-446f-bcb8-784cab0a0627</guid><dc:creator>Mike Schmitt</dc:creator><description>Does the new location get added immediately when the user selects it on the grid, or do they select it on the grid and then press a button (for example) to commit the addition?  Are they able to select more than one item at a time?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to append results in a grid</title><link>https://community.appian.com/thread/48312?ContentTypeID=1</link><pubDate>Thu, 07 Sep 2017 14:56:32 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:88a8b808-61fe-4bc4-823f-18009a830ed4</guid><dc:creator>ck0220</dc:creator><description>Hi Suresh,&lt;br /&gt;
&lt;br /&gt;
I currently have something like this in the a!save piece of my code. &lt;br /&gt;
a!save(&lt;br /&gt;
                    local!selectedlocations,&lt;br /&gt;
                    index(&lt;br /&gt;
                      local!locationsData.data,&lt;br /&gt;
                      wherecontains(&lt;br /&gt;
                        local!gridSelection.selected,&lt;br /&gt;
                        local!locationsdata.identifiers&lt;br /&gt;
                      )&lt;br /&gt;
                    )&lt;br /&gt;
                  )&lt;br /&gt;
&lt;br /&gt;
It seems that to make my code similar to yours, I would a!save(local!selectedlocations,append(local!selectedlocations,{name:save!value}))&lt;br /&gt;
&lt;br /&gt;
what would value be in this case if I do not have a dropdown field like you did?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to append results in a grid</title><link>https://community.appian.com/thread/48308?ContentTypeID=1</link><pubDate>Thu, 07 Sep 2017 12:18:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:de4246a5-bba5-483f-aa42-343edf55a7c8</guid><dc:creator>sureshg57</dc:creator><description>&lt;p&gt;chynnak&lt;/p&gt;
&lt;p&gt;I think what you are looking for something similar to what I have given below. This is a simple representation of similar requirement. Might help in understanding what needs to be done in your scenario.&lt;/p&gt;
&lt;p&gt;i have used a drop down instead of a search grid in this case but concept should be similar.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;=load(
  local!paginInfo:a!pagingInfo(
    startIndex:1,
    batchSize:3
  ),
  local!location,
  local!datavalue:{},

a!formLayout(
  label: &amp;quot;Location sample formm&amp;quot;,
  firstColumnContents: {
    with(
      local!datasubset: todatasubset(local!datavalue,local!paginInfo),{
    a!dropdownField(
      label: &amp;quot;location&amp;quot;,
      choiceLabels:{&amp;quot;norwich&amp;quot;,&amp;quot;london&amp;quot;,&amp;quot;york&amp;quot;,&amp;quot;manchester&amp;quot;},
      choiceValues:{&amp;quot;norwich&amp;quot;,&amp;quot;london&amp;quot;,&amp;quot;york&amp;quot;,&amp;quot;manchester&amp;quot;},
      placeholderLabel:&amp;quot;----choose val-----&amp;quot;,
      labelPosition: &amp;quot;ABOVE&amp;quot;,
      value:local!location,
      saveInto: {local!location,
      a!save(local!datavalue,append(local!datavalue,{name:save!value}))
      },
      refreshAfter: &amp;quot;UNFOCUS&amp;quot;,
      validations: {}
    ),
      a!gridField(
      label: &amp;quot;selected locations&amp;quot;,
      totalCount:local!datasubset.totalCount,
      columns: {
        a!gridTextColumn(
          label: &amp;quot;Name&amp;quot;,
          field: &amp;quot;name&amp;quot;,
          data: index(local!datasubset.data,&amp;quot;name&amp;quot;,null)
            
          )},
          emptyGridMessage:&amp;quot;No locations selected&amp;quot;,
          value:local!paginInfo,
          saveInto:local!paginInfo
      
    )
      }
    )
  },
  secondColumnContents: {
    /* Add components here for a two-column form */
  },
  buttons: a!buttonLayout(
    primaryButtons: {
      a!buttonWidgetSubmit(
        label: &amp;quot;Submit&amp;quot;,
        style: &amp;quot;PRIMARY&amp;quot;,
        saveInto: {}
      )
    },
    secondaryButtons: {
      a!buttonWidgetSubmit(
        label: &amp;quot;Cancel&amp;quot;,
        style: &amp;quot;NORMAL&amp;quot;,
        value: true,
        saveInto: ri!cancel,
        skipValidation: true
      )
    }
  ),
  validations: {}
)

)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Suresh&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to append results in a grid</title><link>https://community.appian.com/thread/48303?ContentTypeID=1</link><pubDate>Thu, 07 Sep 2017 09:51:28 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a7ddb418-28ff-4fa4-b50f-7b459d85f571</guid><dc:creator>annap</dc:creator><description>You can append the selected values to local!variable(here, local!addedValues) and same variable you could configure in your second grid.&lt;br /&gt;
&lt;br /&gt;
 saveInto: a!save(&lt;br /&gt;
            local!addedValues,&lt;br /&gt;
            fn!append(&lt;br /&gt;
              local!addedValues,&lt;br /&gt;
              a!forEach(&lt;br /&gt;
                items: ri!selectedValues,&lt;br /&gt;
                expression: displayvalue(&lt;br /&gt;
                  fv!item,&lt;br /&gt;
                  local!employees.id,&lt;br /&gt;
                  local!employees,&lt;br /&gt;
                  {}&lt;br /&gt;
                )&lt;br /&gt;
              )&lt;br /&gt;
            )&lt;br /&gt;
          )&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to append results in a grid</title><link>https://community.appian.com/thread/48300?ContentTypeID=1</link><pubDate>Thu, 07 Sep 2017 05:26:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6b674207-b4c4-40b3-90e2-4ec3dabb9d68</guid><dc:creator>Rama Thummala</dc:creator><description>&lt;a href="/members/chynnak"&gt;ck0220&lt;/a&gt; , If my assumption is correct, Please have a local variable in load()  and update(append to the existing values) the local variable every time you hit search. Use that local variable in second grid to display. Hope this will help you.&lt;br /&gt;
If not, Please share your code so it will be easy to help.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to append results in a grid</title><link>https://community.appian.com/thread/48295?ContentTypeID=1</link><pubDate>Wed, 06 Sep 2017 22:27:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7f301a6d-5f54-44e4-8e76-3cadb3b40017</guid><dc:creator>Mike Schmitt</dc:creator><description>Can you share the code you have so far?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>