<?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>How to fetch data from nested CDTs data</title><link>https://community.appian.com/discussions/f/data/20721/how-to-fetch-data-from-nested-cdts-data</link><description>I have a nested CDT which contains the response from a service. 
 I want to fetch the data from nested levels. 
 
 &amp;#39;type!{urn:com:appian:types}testCDT&amp;#39;( id: null, response: &amp;#39;type!{urn:com:appian:types}response&amp;#39;( users: { &amp;#39;type!{urn:com:appian:types}users</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to fetch data from nested CDTs data</title><link>https://community.appian.com/thread/80744?ContentTypeID=1</link><pubDate>Tue, 06 Apr 2021 02:10:58 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d1eedbe4-4d6a-4b7f-8cb6-b1a59350730c</guid><dc:creator>Acacio Barrado</dc:creator><description>&lt;p&gt;Hi Ram,&lt;/p&gt;
&lt;p&gt;There are few different ways how you could retrieve the data that you are looking for, but in most cases, you will end up using a looping function.&lt;/p&gt;
&lt;p&gt;If you just want a plain list of the address lines, not considering the address type, you could try a code like the below one, or you could adjust it to your needs.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!test: &amp;#39;type!{urn:com:appian:types}testCDT&amp;#39;(
    id: null,
    response: &amp;#39;type!{urn:com:appian:types}response&amp;#39;(
      users: {
        &amp;#39;type!{urn:com:appian:types}users&amp;#39;(
          userId: &amp;quot;12345&amp;quot;,
          groupId: &amp;quot;2342&amp;quot;,
          addresses: &amp;#39;type!{urn:com:appian:types}userAddress&amp;#39;(
            type: &amp;quot;test&amp;quot;,
            street: &amp;quot;New&amp;quot;,
            addressLines: { &amp;quot;a&amp;quot;, &amp;quot;b&amp;quot; },
            countryCode: &amp;quot;980&amp;quot;,
            postalCode: &amp;quot;6456&amp;quot;
          )
        ),
        &amp;#39;type!{urn:com:appian:types}users&amp;#39;(
          userId: &amp;quot;2568&amp;quot;,
          groupId: &amp;quot;8995&amp;quot;,
          addresses: &amp;#39;type!{urn:com:appian:types}userAddress&amp;#39;(
            type: &amp;quot;NEw test&amp;quot;,
            street: &amp;quot;Old&amp;quot;,
            addressLines: { &amp;quot;c&amp;quot;, &amp;quot;d&amp;quot; },
            countryCode: &amp;quot;589&amp;quot;,
            postalCode: &amp;quot;2546&amp;quot;
          )
        )
      }
    )
  ),
  local!b:  a!flatten(a!forEach(
    items:      index(index(local!test.response,&amp;quot;users&amp;quot;,null),&amp;quot;addresses&amp;quot;,null),
      expression: fv!item.addressLines
    )
    ),
    local!b
  )
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;There was other topics discussing similar situation, you can check the link below for example:&lt;/p&gt;
&lt;p&gt;&lt;a title="Only fields with scalar types can be indexed from an array" href="/discussions/f/data/18587/only-fields-with-scalar-types-can-be-indexed-from-an-array"&gt;Only fields with scalar types can be indexed from an array&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Acacio Barrado&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>