<?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 CDT values in loop</title><link>https://community.appian.com/discussions/f/data/29520/update-cdt-values-in-loop</link><description>I am new to Appian and I need to write a rule that takes an array of CDT objects; updates all of their &amp;quot;id&amp;quot; and &amp;quot;loanId&amp;quot; values to null; and returns them. 
 I have been trying to use a foreach loop as follows but the data won&amp;#39;t change. what am I doing</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: update CDT values in loop</title><link>https://community.appian.com/thread/117028?ContentTypeID=1</link><pubDate>Sat, 29 Jul 2023 18:39:10 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f461da19-a733-4494-a194-46ba7b5baf79</guid><dc:creator>tommerr5996</dc:creator><description>&lt;p&gt;that solved my issue, thank you for the assist&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: update CDT values in loop</title><link>https://community.appian.com/thread/117027?ContentTypeID=1</link><pubDate>Sat, 29 Jul 2023 15:18:17 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2c8cea44-4f1f-482f-a7a7-fbf1e48a92fd</guid><dc:creator>mathurambika0708</dc:creator><description>&lt;p&gt;Thank you,&amp;nbsp;Mathieu,&amp;nbsp;for sharing the optimized code. Previously, I was&amp;nbsp;trying to update&amp;nbsp;two indices/fields with a single value, which resulted in an error. Your code has helped to&amp;nbsp;understand the error.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: update CDT values in loop</title><link>https://community.appian.com/thread/117025?ContentTypeID=1</link><pubDate>Sat, 29 Jul 2023 15:07:28 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9b5d0e7e-cc6d-4133-b87b-5a18034fb444</guid><dc:creator>Mathieu Drouin</dc:creator><description>&lt;p&gt;Here is a slightly more optimized version:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!list: {
    a!map(id: 1, loanid: 6789, acctNum: &amp;quot;ACC1567&amp;quot;),
    a!map(id: 2, loanId: 7823, acctNum: &amp;quot;ACC83049&amp;quot;)
  },
  a!forEach(
    items: local!list,
    expression: a!update(fv!item, { &amp;quot;id&amp;quot;, &amp;quot;loanId&amp;quot; }, { null, null })
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: update CDT values in loop</title><link>https://community.appian.com/thread/117022?ContentTypeID=1</link><pubDate>Sat, 29 Jul 2023 13:58:55 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:16d78387-c15b-48e5-8316-6f1148514bb2</guid><dc:creator>mathurambika0708</dc:creator><description>&lt;p&gt;Hi, I hope the below example helps.&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!inputs: {
    { id: 1, loanid: 6789, acctNum: &amp;quot;ACC1567&amp;quot; },
    { id: 2, loanId: 7823, acctNum: &amp;quot;ACC83049&amp;quot; }
  },
  local!idUpdatedToNull: a!forEach(
    items: local!inputs,
    expression: a!update(fv!item, &amp;quot;id&amp;quot;, null())
  ),
  local!loanIdUpdatedToNull: a!forEach(
    items: local!idUpdatedToNull,
    expression: a!update(fv!item, &amp;quot;loanId&amp;quot;, null())
  ),
  local!loanIdUpdatedToNull
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>