<?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>Updating a CDT array with a single value in a process model</title><link>https://community.appian.com/discussions/f/process/14746/updating-a-cdt-array-with-a-single-value-in-a-process-model</link><description>Hi all, 
 Before writing a CDT array to the database in my process model, I want to update all elements of the array with a different value. How can I do this? 
 For example, let&amp;#39;s say I have a process variable named pv!myCDT (which is a CDT array) with</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Updating a CDT array with a single value in a process model</title><link>https://community.appian.com/thread/66055?ContentTypeID=1</link><pubDate>Tue, 23 Apr 2019 08:17:10 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:23ba83e2-49d8-4f24-a78b-34f6545ec2a9</guid><dc:creator>bhanuprakash1303</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;You can use foreach function for achieving you issue.&lt;/p&gt;
&lt;p&gt;load(&lt;/p&gt;
&lt;p&gt;local!data:&amp;nbsp;{&lt;br /&gt; {&lt;br /&gt; name: &amp;quot;Ben&amp;quot;,&lt;br /&gt; age: 60,&lt;br /&gt;&lt;br /&gt; },&lt;br /&gt; {&lt;br /&gt; name: &amp;quot;Sam&amp;quot;,&lt;br /&gt; age: 65&lt;br /&gt;&lt;br /&gt; }&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;a!foreach(&lt;/p&gt;
&lt;p&gt;items: local!data,&lt;/p&gt;
&lt;p&gt;expression:a!typeyourecdt(&lt;/p&gt;
&lt;p&gt;name:fv!item.name,&lt;/p&gt;
&lt;p&gt;age:fv!item.age,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; retired: false&lt;/p&gt;
&lt;p&gt;)))&lt;/p&gt;
&lt;p&gt;it will help you,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Bhanu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Updating a CDT array with a single value in a process model</title><link>https://community.appian.com/thread/66054?ContentTypeID=1</link><pubDate>Tue, 23 Apr 2019 07:59:31 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6fae5095-dd9b-4d39-9e47-5f2644b9326f</guid><dc:creator>vinayr214137</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Since you data are multiple, you have to use repeat function&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Expression = repeat(count(pv!myCDT),&amp;#39;true&amp;#39;),&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;Operator = &amp;#39;is stored as&amp;#39;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;Target = pv!myCDT.name&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Updating a CDT array with a single value in a process model</title><link>https://community.appian.com/thread/66053?ContentTypeID=1</link><pubDate>Tue, 23 Apr 2019 07:34:15 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:fc51618d-65cb-4827-a620-6f6503a9f0fd</guid><dc:creator>subhad</dc:creator><description>&lt;p&gt;Hi Fabiant,&lt;/p&gt;
&lt;p&gt;You can try below methods,&lt;/p&gt;
&lt;p&gt;1- As you mentioned, you can map/update the values using a script task in the variable.&lt;/p&gt;
&lt;p&gt;2- you can use saveInto of your form buttons too. While submitting, you can update this field alone, so that the CDT variable will have this field updated and you can use write to DSE to update into the database.&lt;/p&gt;
&lt;p&gt;3- You can use updatecdt() function (it&amp;#39;s not an OOTB function).&amp;nbsp;&lt;br /&gt;ex snippet -&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;updatecdt(&lt;br /&gt; ri!myCDT,&lt;br /&gt; {&lt;br /&gt; retired: repeat(&lt;br /&gt; length(&lt;br /&gt; ri!myCDT&lt;br /&gt; ),&lt;br /&gt; true()&lt;br /&gt; )&lt;br /&gt; }&lt;br /&gt;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>