<?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>Help with Expression Rules</title><link>https://community.appian.com/discussions/f/rules/17211/help-with-expression-rules</link><description>Hi All, 
 Am new to Appian and have been stuck with an expression rule for past couple of days with no luck. Following is what am planning to do and pasting my code as well for your expert advise. 
 My intend: 
 (a) there are two CDT arrays, one with</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Help with Expression Rules</title><link>https://community.appian.com/thread/68288?ContentTypeID=1</link><pubDate>Fri, 19 Jul 2019 19:10:33 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e957c8e1-8913-4d22-981e-0dc8b52975be</guid><dc:creator>anilp0001</dc:creator><description>&lt;p&gt;Thanks &lt;a href="/members/ankitab0001"&gt;ankitab0001&lt;/a&gt;. it worked.. forgot to update you...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Help with Expression Rules</title><link>https://community.appian.com/thread/67880?ContentTypeID=1</link><pubDate>Wed, 03 Jul 2019 03:40:34 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:20283124-b391-46ec-9904-95c54a8690f3</guid><dc:creator>ankitab0001</dc:creator><description>&lt;p&gt;Hi &lt;a href="/members/anilp0001"&gt;anilp0001&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As per your code I think&amp;nbsp;You want to pick that index from the array who&amp;#39;s value has been changed and save it into a different cdt&lt;/p&gt;
&lt;p&gt;Instead of casting it directly, try assigning values to each field of the cdt.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;load(
  
  local!beforeCdt: {{field1:&amp;quot;Test1&amp;quot;,field2:&amp;quot;abc&amp;quot;,field5:&amp;quot;123&amp;quot;},{field1:&amp;quot;Test2&amp;quot;,field2:&amp;quot;def&amp;quot;,field5:&amp;quot;456&amp;quot;},{field1:&amp;quot;Test3&amp;quot;,field2:&amp;quot;ghi&amp;quot;,field5:&amp;quot;789&amp;quot;}},
  local!afterCdt: {{field11:&amp;quot;Test1&amp;quot;,field2:&amp;quot;abc&amp;quot;,field5:&amp;quot;1023&amp;quot;},{field1:&amp;quot;Test12&amp;quot;,field2:&amp;quot;def&amp;quot;,field5:&amp;quot;4056&amp;quot;},{field1:&amp;quot;Test13&amp;quot;,field2:&amp;quot;ghi&amp;quot;,field5:&amp;quot;789&amp;quot;}},
  local!finalCdt:
  a!forEach(local!beforeCdt,
    &amp;#39;type!{http://www.test.com./TEST/}CM_CLAIM_TYPE&amp;#39;(
      PHASE:fv!item.field1,
      PROJ_CONTRACT: fv!item.field2,
      DESIGN_TYPE: if(exact(fv!item.field5,local!afterCdt.field5[fv!index]),fv!item.field5,local!afterCdt.field5[fv!index])
    )
  ),
  local!changedCdt:
  a!forEach(local!beforeCdt,
    
      if(
        exact(fv!item.field5,local!afterCdt.field5[fv!index]),
        {},
        &amp;#39;type!{http://www.test.com/TEST/}CM_CLAIM_TYPE&amp;#39;(
        PHASE:fv!item.field1,
        PROJ_CONTRACT: fv!item.field2,
        DESIGN_TYPE: local!afterCdt.field5[fv!index]
        
      )
      
    )
  ),
  local!changedCdt
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>