<?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>Pulling values from &amp;quot;nested&amp;quot; CDT</title><link>https://community.appian.com/discussions/f/data/12450/pulling-values-from-nested-cdt</link><description>I currently have data being pushed into a CDT in the following format: 
 
 Questions_CDT 
 { 
 QuestionID: 1, 
 AnswerIDs: {1,2,3} 
 }, 
 { 
 QuestionID: 2, 
 AnswerIDs: {3} 
 } 
 And I need it to format to: 
 { 
 QuestionID: 1, 
 AnswerID: 1 
 }, 
 </description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Pulling values from "nested" CDT</title><link>https://community.appian.com/thread/55522?ContentTypeID=1</link><pubDate>Tue, 22 May 2018 20:55:31 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2e8bd0b0-d59e-4828-8ad2-208f8ec2c062</guid><dc:creator>Jawara J</dc:creator><description>This is the result I came to (not exactly in this format). Thanks!!!&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Pulling values from "nested" CDT</title><link>https://community.appian.com/thread/55313?ContentTypeID=1</link><pubDate>Thu, 17 May 2018 19:58:16 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f6c3c46e-4b3a-4efd-9ad7-b7e70cff003a</guid><dc:creator>Carlos Santander</dc:creator><description>&lt;p&gt;Assuming QuestionID is always a single value, this will do the trick:&lt;/p&gt;
&lt;pre&gt;= load(&lt;br /&gt; local!input: {&lt;br /&gt; {&lt;br /&gt;  QuestionID: 1,&lt;br /&gt;  AnswerIDs: {1, 2, 3}&lt;br /&gt; },&lt;br /&gt; {&lt;br /&gt;  QuestionID: 2,&lt;br /&gt;  AnswerIDs: {3}&lt;br /&gt; }&lt;br /&gt; },&lt;br /&gt; a!flatten(&lt;br /&gt;  a!foreach(&lt;br /&gt;   items: local!input,&lt;br /&gt;   expression: with(&lt;br /&gt;    local!qID: fv!item,&lt;br /&gt;    a!foreach(&lt;br /&gt;     items: local!qID.AnswerIDs,&lt;br /&gt;     expression: {&lt;br /&gt;      QuestionID: local!qID.QuestionID,&lt;br /&gt;      AnswerID: fv!item&lt;br /&gt;     }&lt;br /&gt;    )&lt;br /&gt;   )&lt;br /&gt;  )&lt;br /&gt; )&lt;br /&gt;)&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>