<?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>Array property indexing and update</title><link>https://community.appian.com/discussions/f/user-interface/12490/array-property-indexing-and-update</link><description>I have an array from selectable editable grid . Now i want to update value in the array under a particular property and then save that to the db. For saving to the database I am using writeToDataStoreEntity but i need to update some text and then submit</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Array property indexing and update</title><link>https://community.appian.com/thread/55521?ContentTypeID=1</link><pubDate>Tue, 22 May 2018 20:21:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:86c05aba-f8b9-4269-ad12-38f683f39f71</guid><dc:creator>Ashvin Kapur</dc:creator><description>If installing the plugin is not an option, then I would suggest one of the following:&lt;br /&gt;
1. Simply save values using a!save(local!rowData.ppiStatus, &amp;quot;Void&amp;quot;) for each selected row&lt;br /&gt;
2. namk&amp;#39;s explanation of using the type! constructor&lt;br /&gt;
&lt;br /&gt;
This is all assuming there are not going to be a huge number of selected rows to which applying over them would be a performance concern.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Array property indexing and update</title><link>https://community.appian.com/thread/55520?ContentTypeID=1</link><pubDate>Tue, 22 May 2018 20:19:09 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:50ba4db1-538b-47d8-a6c8-8689cf0e0bf0</guid><dc:creator>Parveen</dc:creator><description>Also, i am using 18.1 since i am missing plug-in that is perhaps why i do not see any documentation either.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Array property indexing and update</title><link>https://community.appian.com/thread/55519?ContentTypeID=1</link><pubDate>Tue, 22 May 2018 20:14:59 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:efced216-0f4d-401f-b6ef-39d9b89f38da</guid><dc:creator>Parveen</dc:creator><description>Aah, i do not have the updatecdt plug in installed in the cloud env, i am using. Is there a way around to updatecdt ?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Array property indexing and update</title><link>https://community.appian.com/thread/55518?ContentTypeID=1</link><pubDate>Tue, 22 May 2018 20:06:49 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:440cd084-864e-4168-a58e-b08804676ed2</guid><dc:creator>Ashvin Kapur</dc:creator><description>You may not even need the a!forEach() since updatecdt seems to take a list of CDTs as a parameter.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Array property indexing and update</title><link>https://community.appian.com/thread/55517?ContentTypeID=1</link><pubDate>Tue, 22 May 2018 20:05:39 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:91946c2e-2923-4563-a60b-129fe20e38e5</guid><dc:creator>Ashvin Kapur</dc:creator><description>Once you have local!rowData as your cdt values, you can simply do the following:&lt;br /&gt;
&lt;br /&gt;
a!forEach(items: local!rowData, expression: updatecdt(cdt: cons!APP_CDT, fieldsAndValues: {ppiStatus: &amp;quot;Void&amp;quot;}))&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Array property indexing and update</title><link>https://community.appian.com/thread/55516?ContentTypeID=1</link><pubDate>Tue, 22 May 2018 20:01:01 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9fca3e7f-923f-4053-988b-cc688637a914</guid><dc:creator>Parveen</dc:creator><description>The way i have it is:     a!save(local!Rowdata,&lt;br /&gt;
          index(local!ticketInfo.data,wherecontains(&lt;br /&gt;
            local!gridSelection.selected,&lt;br /&gt;
            local!ticketInfo.identifiers&lt;br /&gt;
          ),{}&lt;br /&gt;
            )&lt;br /&gt;
              )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So local!Rowdata has only the selected records from the editable. Now I want to go to each record and set the status field to void. I was hoping to find the index of the value that i get by doing: index(local!rowdata,&amp;quot;ppiStatus&amp;quot;} and then somehow use updatearray to replace the status value with &amp;quot;void&amp;quot;. Then submit local!Rowdata using WrtToDS. Hoping my approach is correct.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Array property indexing and update</title><link>https://community.appian.com/thread/55514?ContentTypeID=1</link><pubDate>Tue, 22 May 2018 19:48:32 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:12e061a3-b4b1-4bcb-862c-2ed6d9dc915b</guid><dc:creator>Ashvin Kapur</dc:creator><description>It looks like the updatecdt() function would be helpful for your use case. You would set the fieldsAndValues parameters to include all of the fields you&amp;#39;d like to update. For example: {ppiStatus: &amp;quot;Void&amp;quot;, modifiedBy: loggedInUser()} etc.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Array property indexing and update</title><link>https://community.appian.com/thread/55512?ContentTypeID=1</link><pubDate>Tue, 22 May 2018 19:19:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:aa5ca61b-9a42-4760-81eb-8317372ca411</guid><dc:creator>namk</dc:creator><description>&lt;p&gt;Have you looked at casting it with a rule? for example: &lt;br /&gt; &lt;br /&gt; cast(&lt;br /&gt; &amp;#39;type!{urn:com:appian:ZOO}ZOO_pens&amp;#39;,&lt;br /&gt; {&lt;br /&gt; id: if(isnull(ri!id), ri!pen.id, ri!id),&lt;br /&gt; name: if(isnull(ri!name), ri!pen.name, ri!name),&lt;br /&gt; photoId: if(isnull(ri!photoId), ri!pen.photoId, ri!photoId),&lt;br /&gt; dateAdded: if(isnull(ri!dateAdded), ri!pen.dateAdded, ri!dateAdded),&lt;br /&gt; addedBy: if(isnull(ri!addedBy), ri!pen.addedBy, ri!addedBy),&lt;br /&gt; status: if(isnull(ri!status), ri!pen.status, ri!status),&lt;br /&gt; type: if(isnull(ri!type), ri!pen.type, ri!type),&lt;br /&gt; isInactive: if(isnull(ri!isInactive), ri!pen.isInactive, ri!isInactive),&lt;br /&gt; inRepair: if(isnull(ri!inRepair), ri!pen.inRepair, ri!inRepair)&lt;br /&gt; }&lt;br /&gt; )&lt;br /&gt; &lt;br /&gt; You can then call this on your expression rule in an a!save, where you update the array with the expression. You can pass in the whole array, and also specify named variables so that those are updated properly. You can then call the WriteToDS function to save the array.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>