<?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>Update Property In Array Of Objects</title><link>https://community.appian.com/discussions/f/general/8911/update-property-in-array-of-objects</link><description>I am fairly new to Appian, and I want to dynamically update a property in array of objects (the objects are of any type). so in terms of other programming language, something like below: ri!List_Of_Any_Type_Object[ri!Index_Of_Object].&amp;lt;Property_Name&amp;gt; </description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Update Property In Array Of Objects</title><link>https://community.appian.com/thread/39781?ContentTypeID=1</link><pubDate>Tue, 29 Nov 2016 16:41:09 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5640d626-83cb-48c6-8e82-137aca409590</guid><dc:creator>venkateshs329</dc:creator><description>Ok thanks stefan , as of my knowledge  For dictionaries the below rule work&lt;br /&gt;&lt;br /&gt;updatecdt(ri!items,{&amp;quot;TEST&amp;quot;:repeat(count(ri!items),ri!value)})&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update Property In Array Of Objects</title><link>https://community.appian.com/thread/39773?ContentTypeID=1</link><pubDate>Tue, 29 Nov 2016 14:54:30 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:578a3624-5ec8-4c42-b5f9-2f7960ced422</guid><dc:creator>Stefan Helzle</dc:creator><description>It might not work for dictionaries without some changes. I tested with CDT types only.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update Property In Array Of Objects</title><link>https://community.appian.com/thread/39771?ContentTypeID=1</link><pubDate>Tue, 29 Nov 2016 14:50:30 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a47e29f1-f0fb-45bb-9822-fe0781c25f19</guid><dc:creator>Stefan Helzle</dc:creator><description>Your example data is a list of data. To update this you have to use the apply() function like apply(rule!updateCdt(data:_, field: &amp;quot;Test&amp;quot;, value:123456), local!data)&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update Property In Array Of Objects</title><link>https://community.appian.com/thread/39768?ContentTypeID=1</link><pubDate>Tue, 29 Nov 2016 14:12:26 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:31d82bfa-0685-4ccf-af97-41d5796e059b</guid><dc:creator>venkateshs329</dc:creator><description>ok , thanks for the response stefan . i passed below data as inputs it&amp;#39;s return an error.&lt;br /&gt;Expression evaluation error at function &amp;#39;updatecdt&amp;#39; [line 29]: Error evaluating function &amp;#39;updatecdt&amp;#39; : Length of input arrays must equal length of CDT/Dictionary array&lt;br /&gt;&lt;br /&gt;data: {&lt;br /&gt;  {name:&amp;quot;vsuram&amp;quot;,dept:&amp;quot;IT&amp;quot;},&lt;br /&gt;  {name:&amp;quot;vsuram&amp;quot;,dept:&amp;quot;IT&amp;quot;}&lt;br /&gt;},&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Field:&amp;quot;Test&amp;quot;&lt;br /&gt;value:123456&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update Property In Array Of Objects</title><link>https://community.appian.com/thread/39761?ContentTypeID=1</link><pubDate>Tue, 29 Nov 2016 13:36:38 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5b32efe3-c74e-4e90-a6b3-a63e4c570d50</guid><dc:creator>Stefan Helzle</dc:creator><description>updatecdt() has two parameters, the CDT itself and a list of fieldname/value pairs. Why would you want to create another expression?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update Property In Array Of Objects</title><link>https://community.appian.com/thread/39756?ContentTypeID=1</link><pubDate>Tue, 29 Nov 2016 11:41:09 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1e955008-1e2c-4d60-91a8-db308700ae71</guid><dc:creator>venkateshs329</dc:creator><description>@Stefah: Can i need to create one more expression rule for updatecdt with three inputs like as you said[data,field,value] ?&lt;br /&gt;If it is correct but you are passed onlly two parameters in updatecdt function in line num 34&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update Property In Array Of Objects</title><link>https://community.appian.com/thread/39626?ContentTypeID=1</link><pubDate>Wed, 23 Nov 2016 18:08:06 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f665e91a-2f9e-401d-950f-f3f840911c0f</guid><dc:creator>Stefan Helzle</dc:creator><description>Find a working solution in the attached file.&lt;br /&gt;&lt;p&gt;&lt;a href="/cfs-filesystemfile/__key/communityserver-discussions-components-files/11/updateCdt.txt"&gt;updateCdt.txt&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update Property In Array Of Objects</title><link>https://community.appian.com/thread/39609?ContentTypeID=1</link><pubDate>Wed, 23 Nov 2016 10:01:05 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:138e7a24-fb31-4a3e-8d0a-8bad11bb23b5</guid><dc:creator>Stefan Helzle</dc:creator><description>I strongly suggest to NOT use the eval function as it is internal API and can be changed at any time. I did some investigation on this topic and the only way, I found without creating a special plugin, is to use JSON or XML as an intermediary format in which I can change the name of the key.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update Property In Array Of Objects</title><link>https://community.appian.com/thread/39606?ContentTypeID=1</link><pubDate>Wed, 23 Nov 2016 02:45:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b78738e8-8b96-4700-951b-ffe4653e404c</guid><dc:creator>piyushk</dc:creator><description>You can create a string of code and use internal eval function to evaluate the code. I have not used updatecdt function but the syntax would look something like this.&lt;br /&gt;&lt;br /&gt;eval(concat(&amp;quot;updatecdt(local!a, { &amp;quot;, ri!propertyName , &amp;quot;:{5,6} })&amp;quot;))&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update Property In Array Of Objects</title><link>https://community.appian.com/thread/39600?ContentTypeID=1</link><pubDate>Tue, 22 Nov 2016 23:56:06 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c5ebf7ee-d071-43ba-b092-24100c6a290a</guid><dc:creator>Poorna Guduri</dc:creator><description>Added to above, Find the below code snippet with which you can update a dynamic property of a given cdt. There are 2 base rules:&lt;br /&gt;1. to create dictionary with some work around&lt;br /&gt;2. to update a specific peroperty of the cdt&lt;br /&gt;&lt;br /&gt;And there is a main rule where I have formed the cdt as a static dictionary, which you can make as a parameter to the rule, and forming the dictionary values using the first base rule and then updating the indexed cd t row with the formed fieldAndValue parameter. Here I have made use of reduce function because if you need to update more than 1 parameter at the same index of the cdt, the function updatecdt() won&amp;#39;t give proper result and if you go for apply() function it will result in as many number of rows as have for local!fieldAndValue variable.&lt;br /&gt;It is just a work around that may help you.&lt;br /&gt;&lt;p&gt;&lt;a href="/cfs-filesystemfile/__key/communityserver-discussions-components-files/11/Updating-Dynamic-Property-of-a-CDT.txt"&gt;Updating Dynamic Property of a CDT.txt&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update Property In Array Of Objects</title><link>https://community.appian.com/thread/39599?ContentTypeID=1</link><pubDate>Tue, 22 Nov 2016 23:34:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:860fceea-9570-4e36-b101-cd540af4e686</guid><dc:creator>Stefan Helzle</dc:creator><description>There is a trick that uses updatecdt to update any field in a CDT. The problem with updatecdt is that you cannot create a dictionary with dynamic key names. To do that you create a dictionary with a fixed key name, convert it to JSON, replace the key name with your dynamic name and convert it back to an Appian dictionary. Check the code below. There is one issue. JSON does not handly date and datetime values correctly. To get this you can convert date/datetime values to a decimal. Appian automatically converts a decimal back to a correct date/datetime.&lt;br /&gt;&lt;br /&gt;a!fromJson(substitute(a!toJson({X_A_Z_Q_Y:local!valueExternal}), &amp;quot;X_A_Z_Q_Y&amp;quot;, ri!name))&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update Property In Array Of Objects</title><link>https://community.appian.com/thread/39595?ContentTypeID=1</link><pubDate>Tue, 22 Nov 2016 21:33:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f5d4af17-8f97-492e-8c1e-c69c782b810f</guid><dc:creator>minalabib</dc:creator><description>@ramanjaneyulut &lt;br /&gt;I do not see how that will handle dynamic property name in my last comment, can you elaborate?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update Property In Array Of Objects</title><link>https://community.appian.com/thread/39593?ContentTypeID=1</link><pubDate>Tue, 22 Nov 2016 21:21:22 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c390e4e6-a24a-43ae-a4b9-523295c7398d</guid><dc:creator>Rama Thummala</dc:creator><description>@manil&lt;br /&gt;Please use the apply() function along with updatecdt()&lt;br /&gt;&lt;br /&gt;apply(&lt;br /&gt;rule!&amp;lt;rule to update cdt&amp;gt;i.e.,use the updatecdt() inside the rule&lt;br /&gt;cdtlist &lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update Property In Array Of Objects</title><link>https://community.appian.com/thread/39592?ContentTypeID=1</link><pubDate>Tue, 22 Nov 2016 21:19:49 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0a6031fa-1e10-452e-a10a-e8d574d83023</guid><dc:creator>minalabib</dc:creator><description>Thank you.&lt;br /&gt;What if the Property_Name is dynamic as well, meaning the Property_Name will be an input to my expression rule.&lt;br /&gt;&lt;br /&gt;For example, in CDT Manipulation plugin it shows below example:&lt;br /&gt;updatecdt(local!a, { a:{5,6} }) &lt;br /&gt;&lt;br /&gt;That example assumes property &amp;quot;a&amp;quot; in local variable &amp;quot;local!a&amp;quot; is known, what if the property name is not know in run time and will be passed as input (i.e. ri!propertyName); is there a way to do that in SAIL ?&lt;br /&gt;&lt;br /&gt;again excuse my little knowledge in Appian! :)&lt;br /&gt;&lt;br /&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update Property In Array Of Objects</title><link>https://community.appian.com/thread/39591?ContentTypeID=1</link><pubDate>Tue, 22 Nov 2016 21:06:43 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4c260ec3-f868-44e1-a1ba-f163a6964ba0</guid><dc:creator>Ram</dc:creator><description>Adding to the above comment i would also suggest you to use updatecdt() function in CDT Manipulation plugin. More information can be obtained by referring to the below link.&lt;br /&gt;&lt;br /&gt;&lt;a href="https://forum.appian.com/suite/tempo/records/item/lMBCLGOdlMUpdGVqW3dQaIKmclBmvvNEj8vu_cjb7T-5YiPr4Fu8ly5Yj1s09uenE4RYzA8zKyx7eiUhu-iLnNiL_yNHr1dalWMFghiqrZpWgaUrg/view/summary"&gt;forum.appian.com/.../summary&lt;/a&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update Property In Array Of Objects</title><link>https://community.appian.com/thread/39590?ContentTypeID=1</link><pubDate>Tue, 22 Nov 2016 20:58:58 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e6fabd30-b578-4160-898b-7ff665f4eec0</guid><dc:creator>Ram</dc:creator><description>Hi Minal,&lt;br /&gt;&lt;br /&gt;You can update a value in a array of objects using updatearray() function. More information regarding the function can be obtained by referring to the below link.&lt;br /&gt;&lt;br /&gt;&lt;a href="https://forum.appian.com/suite/help/16.3/Array_Functions.html#updatearray.28.29"&gt;forum.appian.com/.../Array_Functions.html&lt;/a&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>