<?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>Save only updated data from a given array</title><link>https://community.appian.com/discussions/f/new-to-appian/38364/save-only-updated-data-from-a-given-array</link><description>Hi All, 
 
 
 I have a query if we have two array one is local!finalGridData and second one is local!origionalData. 
 In the local!finalgridData i have updated data 
 local!finalGridData containing data like- 
 1. id:1, enddate: 21/01/2025 , 
 id:1, endDate</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Save only updated data from a given array</title><link>https://community.appian.com/thread/144564?ContentTypeID=1</link><pubDate>Tue, 21 Jan 2025 10:43:52 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:75f9a361-6607-4ec6-9185-c7a9eb4d385f</guid><dc:creator>JayaPrakash Ravipati</dc:creator><description>&lt;p&gt;Can&amp;nbsp; you elaborate your scenario some more&amp;nbsp; and you are trying it in interface or expression rule.&lt;/p&gt;
&lt;p&gt;difference will work&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Save only updated data from a given array</title><link>https://community.appian.com/thread/144563?ContentTypeID=1</link><pubDate>Tue, 21 Jan 2025 10:41:32 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:59252f6b-1a7e-4329-8277-646f2b583411</guid><dc:creator>madhup0003</dc:creator><description>&lt;p&gt;thanks&amp;nbsp;&lt;a class="internal-link view-user-profile" href="/members/jayaprakashr0001"&gt;JayaPrakash Ravipati&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;yes i need only that data which is modified in local!finalGirddata, but i can&amp;#39;t use grid for that even&amp;nbsp;difference&amp;nbsp; will not work&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Save only updated data from a given array</title><link>https://community.appian.com/thread/144562?ContentTypeID=1</link><pubDate>Tue, 21 Jan 2025 10:30:28 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a9c9efeb-bfef-41ea-90ab-c2795798c692</guid><dc:creator>JayaPrakash Ravipati</dc:creator><description>&lt;p&gt;HI &lt;a href="/members/madhup0003"&gt;madhup0003&lt;/a&gt;&amp;nbsp;,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;As per my understanding you need only the data that is modified to store. You can use the difference() to get the modified data.&lt;/p&gt;
&lt;p&gt;The below code might help.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!options:{&amp;quot;Yes&amp;quot;,&amp;quot;No&amp;quot;},
  local!originalGridData:a!refreshVariable(
    value: {
      a!map(id:&amp;quot;1&amp;quot;,date:date(2025,1,15)),
      a!map(id:&amp;quot;1&amp;quot;,date:date(2025,1,16)),
      a!map(id:&amp;quot;1&amp;quot;,date:date(2025,1,14)),
      a!map(id:&amp;quot;2&amp;quot;,date:date(2025,1,17)),
      a!map(id:&amp;quot;2&amp;quot;,date:date(2025,1,15)),
    },
    refreshOnReferencedVarChange: false()
  ),
  local!changedData,
  local!finaldata:local!originalGridData,
  {
  a!gridLayout(
    headerCells: {
      a!gridLayoutHeaderCell(label:&amp;quot;Id&amp;quot;),
      a!gridLayoutHeaderCell(label:&amp;quot;Date&amp;quot;),
    },
    columnConfigs: {
      a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;),
      a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;),
    },
    rows: a!forEach(
      items: local!finaldata,
      expression: a!gridRowLayout(
        contents: {
         a!textField(
           value: fv!item.id,
           saveInto: fv!item.id
         ),
         a!dateField(
           value: fv!item.date,
           saveInto: fv!item.date
         )
        }
      )
    ),
  ),
  a!buttonArrayLayout(
    buttons: {
      a!buttonWidget(
        label:&amp;quot;Save&amp;quot;,
        saveInto: {
          a!save(local!changedData,difference(local!finaldata,local!originalGridData))
        }
      )
    }
  ),
  /*Changed data*/
  a!gridField(
    data: local!changedData,
    columns: {
      a!gridColumn(
        label:&amp;quot;Id&amp;quot;,
        value: fv!row.id
      ),
      a!gridColumn(
        label:&amp;quot;Date&amp;quot;,
        value: fv!row.date
      )
    },
    borderStyle: &amp;quot;STANDARD&amp;quot;
  )
  }
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Save only updated data from a given array</title><link>https://community.appian.com/thread/144551?ContentTypeID=1</link><pubDate>Tue, 21 Jan 2025 08:39:03 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1bf9cc11-9a0d-4b8f-a911-39e50af7d5b1</guid><dc:creator>madhup0003</dc:creator><description>&lt;p&gt;thanks i am trying with given use case.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Save only updated data from a given array</title><link>https://community.appian.com/thread/144548?ContentTypeID=1</link><pubDate>Tue, 21 Jan 2025 08:02:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:fc4fae05-0324-4597-bacc-8979efd93f26</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;Sure, but remove does not do that. It removes an item from a list by its index. You do not pass the list, but the item you iterate on.&lt;/p&gt;
&lt;p&gt;Find an example here:&amp;nbsp;&lt;a href="https://docs.appian.com/suite/help/24.4/Function_Recipes.html#extract-a-list-from-an-entitydata-array-of-the-data-written-to-a-single-entity"&gt;https://docs.appian.com/suite/help/24.4/Function_Recipes.html#extract-a-list-from-an-entitydata-array-of-the-data-written-to-a-single-entity&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Save only updated data from a given array</title><link>https://community.appian.com/thread/144547?ContentTypeID=1</link><pubDate>Tue, 21 Jan 2025 07:47:10 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0fc2801d-b1e3-4a32-a148-e2cb6623e4fc</guid><dc:creator>madhup0003</dc:creator><description>&lt;p&gt;i am trying to remove those ids which are not updated in finalgriddata.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Save only updated data from a given array</title><link>https://community.appian.com/thread/144546?ContentTypeID=1</link><pubDate>Tue, 21 Jan 2025 07:45:02 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:be9a0d3c-823a-4f51-b461-b2eb74e6c146</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;That condition looks plausible, but what do you try to do with that remove()?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Save only updated data from a given array</title><link>https://community.appian.com/thread/144545?ContentTypeID=1</link><pubDate>Tue, 21 Jan 2025 07:42:02 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ca589fd2-3592-4d47-8e8c-e2065ef6fff2</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/62/pastedimage1737445317620v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Save only updated data from a given array</title><link>https://community.appian.com/thread/144543?ContentTypeID=1</link><pubDate>Tue, 21 Jan 2025 07:36:06 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0ad3426e-33ac-4648-bd74-0eed3f3077d2</guid><dc:creator>madhup0003</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;a class="internal-link view-user-profile" href="/members/stefanhelzle0001"&gt;Stefan Helzle&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;i have tried this, but it&amp;#39;s not working&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;a!save(local!test, &lt;br /&gt; a!forEach(&lt;br /&gt; items: local!finalgridData,&lt;br /&gt; expression: if(&lt;br /&gt; fv!item.endDate=index(local!originalData.data,&lt;br /&gt; wherecontains(touniformstring(fv!item.endDate), &lt;br /&gt; touniformstring(local!originalData.data.endDate)),{}).endDate,&lt;br /&gt; remove(fv!item, index(local!originalData,&lt;br /&gt; wherecontains(touniformstring(fv!item.referenceNumber),touniformstring(local!originalData.data.referenceNumber), ),{})),&lt;br /&gt; fv!item&lt;br /&gt; &lt;br /&gt; )),&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: Save only updated data from a given array</title><link>https://community.appian.com/thread/144540?ContentTypeID=1</link><pubDate>Tue, 21 Jan 2025 07:02:53 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:aa780e1f-394d-4394-aa8a-88b9b2fb647a</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;What did you try so far? I mean, this is not more than a foreach() on the your final data, and a condition to either include or exclude the data from the resulting list.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>