<?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>Hello everyone,I am trying to use expandcdt() function</title><link>https://community.appian.com/discussions/f/general/12515/hello-everyone-i-am-trying-to-use-expandcdt-function</link><description>Hi, 
 I am trying to expand my CDT using expandcdt() function. It is given that the expand field parameter accepts input in &amp;quot;???function.expandcdt.param.expandField.description???&amp;quot; format. I am unable to figure out the input. 
 My CDT structure looks</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Hello everyone,I am trying to use expandcdt() function</title><link>https://community.appian.com/thread/55721?ContentTypeID=1</link><pubDate>Fri, 25 May 2018 13:55:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:59423b5e-f757-4286-940a-81827bac78df</guid><dc:creator>Sunil Zacharia</dc:creator><description>&lt;p&gt;Here&amp;#39;s a cheeky solution for your problem. This code will give you list of column names in your cdt that have changed.&lt;/p&gt;
&lt;p&gt;It does not work for nested cdt&amp;#39;s but you can try to improve on this. Hope it helps.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;pre class="ui-code" data-mode="text"&gt;load(
  local!disectCdt: rule!disectCDT(
                      cdt1: &amp;#39;type!&amp;lt;cdt&amp;gt;&amp;#39;(a: 1, b: &amp;quot;doc1&amp;quot;, c: &amp;quot;desc1&amp;quot;),
                      cdt2: &amp;#39;type!&amp;lt;cdt&amp;gt;&amp;#39;(a: 1, b: &amp;quot;doc1&amp;quot;, c: &amp;quot;&amp;quot;)
                   ),
  local!cdtColumns: index(index(local!disectCdt, &amp;quot;cdt1&amp;quot;), &amp;quot;columnArray&amp;quot;),
  local!cdt1Values: index(index(local!disectCdt, &amp;quot;cdt1&amp;quot;), &amp;quot;valueArray&amp;quot;),
  local!cdt2Values: index(index(local!disectCdt, &amp;quot;cdt2&amp;quot;), &amp;quot;valueArray&amp;quot;),
  local!changedColumnIndex: where(
                                a!forEach(
                                local!cdt1Values,
                                fv!item &amp;lt;&amp;gt; local!cdt2Values[fv!index]
                              )
                            ),
  index(local!cdtColumns, local!changedColumnIndex)
)&lt;/pre&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;And this is your supporting rule&amp;nbsp;&lt;em&gt;rule!disectCDT&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;pre class="ui-code" data-mode="text"&gt;if(
  runtimetypeof(ri!cdt1) &amp;lt;&amp;gt; runtimetypeof(ri!cdt2),
  null,
  load(
    local!cdt1ToColVal: split(stripwith(touniformstring(ri!cdt1),&amp;quot;[]&amp;quot;),&amp;quot;,&amp;quot;),
    local!cdt1Columns: a!forEach(local!cdt1ToColVal, split(fv!item, &amp;quot;=&amp;quot;)[1]),
    local!cdt1Values: a!forEach(local!cdt1ToColVal, split(fv!item, &amp;quot;=&amp;quot;)[2]),
    
    local!cdt2ToColVal: split(stripwith(touniformstring(ri!cdt2),&amp;quot;[]&amp;quot;),&amp;quot;,&amp;quot;),
    local!cdt2Columns: a!forEach(local!cdt2ToColVal, split(fv!item, &amp;quot;=&amp;quot;)[1]),
    local!cdt2Values: a!forEach(local!cdt2ToColVal, split(fv!item, &amp;quot;=&amp;quot;)[2]),
    {
      cdt1: {
        columnArray: local!cdt1Columns,
        valueArray: local!cdt1Values
      },
      cdt2: {
        columnArray: local!cdt2Columns,
        valueArray: local!cdt2Values
      }
    }
  )
)&lt;/pre&gt;&lt;/code&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hello everyone,I am trying to use expandcdt() function</title><link>https://community.appian.com/thread/55713?ContentTypeID=1</link><pubDate>Fri, 25 May 2018 12:50:36 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:94165b7b-c2a8-4834-9aa5-45ef643a93b7</guid><dc:creator>Pradeep Gudishana</dc:creator><description>we want difference of nested CDT i.e what all fields have changed for audit purpose&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hello everyone,I am trying to use expandcdt() function</title><link>https://community.appian.com/thread/55711?ContentTypeID=1</link><pubDate>Fri, 25 May 2018 12:30:52 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:48d073b1-6f17-476c-bce2-d294a8382ea8</guid><dc:creator>Sunil Zacharia</dc:creator><description>Looks like the expandcdt is buggy. Better to look for an alternative to suffice your requirement. What exactly are you trying to achieve?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hello everyone,I am trying to use expandcdt() function</title><link>https://community.appian.com/thread/55694?ContentTypeID=1</link><pubDate>Fri, 25 May 2018 10:31:11 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b0766abf-a814-4026-acde-1ec9802f6287</guid><dc:creator>Pradeep Gudishana</dc:creator><description>Hi,&lt;br /&gt;
Can some one suggest me, how can we do difference of two CDT&amp;#39;s which are not nested, i shld get the fields that are changed without using plugin. is this possible?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hello everyone,I am trying to use expandcdt() function</title><link>https://community.appian.com/thread/55692?ContentTypeID=1</link><pubDate>Fri, 25 May 2018 10:28:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3e90f9ef-7c59-4531-b570-cc81e4acae0f</guid><dc:creator>soujanyac0001</dc:creator><description>For anonymous cdt it is working but for cdt type it is not working.Can you suggest for cdt type.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hello everyone,I am trying to use expandcdt() function</title><link>https://community.appian.com/thread/55685?ContentTypeID=1</link><pubDate>Fri, 25 May 2018 09:36:17 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f5792280-a541-419f-a5a1-1a0307681555</guid><dc:creator>Sunil Zacharia</dc:creator><description>Please refer my previous comment for an example with nested cdt&amp;#39;s&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hello everyone,I am trying to use expandcdt() function</title><link>https://community.appian.com/thread/55684?ContentTypeID=1</link><pubDate>Fri, 25 May 2018 09:33:47 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7212447b-1753-4e17-ad62-445c358e1d66</guid><dc:creator>Pradeep Gudishana</dc:creator><description>Hi,&lt;br /&gt;
How can we achieve for nested CDT types&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hello everyone,I am trying to use expandcdt() function</title><link>https://community.appian.com/thread/55683?ContentTypeID=1</link><pubDate>Fri, 25 May 2018 09:24:48 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e497424a-eb76-43f4-82fb-21098933c418</guid><dc:creator>Sunil Zacharia</dc:creator><description>&lt;p&gt;Here&amp;#39;s another example with nested cdt&amp;#39;s&lt;/p&gt;
&lt;p&gt;&lt;code&gt;load(&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp;local!subCdt: {it1: &amp;quot;item1&amp;quot;, it2: &amp;quot;item2&amp;quot;, it3: &amp;quot;item3&amp;quot;},&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp;local!topicCdt: {&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{id: 1, topic: &amp;quot;SimpleTopic1&amp;quot;, subTopicList: {a: local!subCdt, b: local!subCdt, c: local!subCdt}}&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;},&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp;expandcdt(&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp; cdt: local!topicCdt,&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp; expandField: &amp;quot;subTopicList&amp;quot;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp;)&lt;/code&gt;&lt;br /&gt;&lt;code&gt;)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Output:&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;List of Dictionary: 1 item Dictionary &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;id: 1 topic: &amp;quot;SimpleTopic1&amp;quot; &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;nbsp; nest.a: Dictionary &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; it1: &amp;quot;item1&amp;quot; &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; it2: &amp;quot;item2&amp;quot; &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; it3: &amp;quot;item3&amp;quot; &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;nbsp; nest.b: Dictionary &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; it1: &amp;quot;item1&amp;quot; &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; it2: &amp;quot;item2&amp;quot; &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; it3: &amp;quot;item3&amp;quot; &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;nbsp; nest.c: Dictionary &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; it1: &amp;quot;item1&amp;quot; &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; it2: &amp;quot;item2&amp;quot; &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; it3: &amp;quot;item3&amp;quot;&lt;/code&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hello everyone,I am trying to use expandcdt() function</title><link>https://community.appian.com/thread/55681?ContentTypeID=1</link><pubDate>Fri, 25 May 2018 09:19:23 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ed0240d9-9927-4fc4-8177-e29fd9a21127</guid><dc:creator>Sunil Zacharia</dc:creator><description>expandcdt works only on list fields. What&amp;#39;s the structure of your employee cdt and what type is empGender?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hello everyone,I am trying to use expandcdt() function</title><link>https://community.appian.com/thread/55679?ContentTypeID=1</link><pubDate>Fri, 25 May 2018 09:14:36 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:54ea3ec3-4546-4cb5-a33e-01a46ebd4f22</guid><dc:creator>soujanyac0001</dc:creator><description>&lt;p&gt;Hi Sunil,&lt;br /&gt; &lt;br /&gt; If given in your mentioned format it is working.If i tried taking my cdt as a rule input as below,&lt;br /&gt; &lt;br /&gt; expandcdt(&lt;br /&gt; cdt:ri!employee,&lt;br /&gt; expandField:&amp;quot;empGender&amp;quot;&lt;br /&gt; )&lt;br /&gt; &lt;br /&gt; I am getting the error-&amp;quot;Expression evaluation error at function &amp;#39;expandcdt&amp;#39;&amp;quot;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hello everyone,I am trying to use expandcdt() function</title><link>https://community.appian.com/thread/55677?ContentTypeID=1</link><pubDate>Fri, 25 May 2018 09:05:04 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:59f88848-6fc1-42f5-83cb-850cc26677a0</guid><dc:creator>Sunil Zacharia</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The expandcdt smart service function documentation is misleading. It is not documented well.&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s an example of how you can use this function:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;load(&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;nbsp;local!topicCdt: &amp;nbsp;{&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{id: 1, topic: &amp;quot;SimpleTopic1&amp;quot;, subTopicList: {&amp;quot;item1&amp;quot;, &amp;quot;item2&amp;quot;, &amp;quot;item3&amp;quot;}},&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{id: 2, topic: &amp;quot;SimpleTopic2&amp;quot;, subTopicList: {&amp;quot;item4&amp;quot;, &amp;quot;item5&amp;quot;, &amp;quot;item6&amp;quot;}}&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; },&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp;expandcdt(&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp;cdt: local!topicCdt,&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp;expandField: &amp;quot;subTopicList&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;nbsp;)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;And the output would be :&lt;/p&gt;
&lt;p&gt;&lt;code&gt;List of Dictionary: 6 items Dictionary &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;id: 1 topic: &amp;quot;SimpleTopic1&amp;quot; subTopicList: &amp;quot;item1&amp;quot; &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Dictionary &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;id: 1 topic: &amp;quot;SimpleTopic1&amp;quot; subTopicList: &amp;quot;item2&amp;quot; &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Dictionary &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;id: 1 topic: &amp;quot;SimpleTopic1&amp;quot; subTopicList: &amp;quot;item3&amp;quot; &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Dictionary &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;id: 2 topic: &amp;quot;SimpleTopic2&amp;quot; subTopicList: &amp;quot;item4&amp;quot; &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Dictionary &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;id: 2 topic: &amp;quot;SimpleTopic2&amp;quot; subTopicList: &amp;quot;item5&amp;quot; &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Dictionary &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;id: 2 topic: &amp;quot;SimpleTopic2&amp;quot; subTopicList: &amp;quot;item6&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;nbsp;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Hope this answers your question. Good luck!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Sunil Zacharia&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>