<?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>nested CDTs and Writing Data to Database</title><link>https://community.appian.com/discussions/f/data/14089/nested-cdts-and-writing-data-to-database</link><description>Hi, I have multiple CDTs that have various relationships set up. What I am not clear on is how the ids that would enable the records to relate appropriately are passed from the parent CDT to the child CDT? For example, if an app allows you to create a</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: nested CDTs and Writing Data to Database</title><link>https://community.appian.com/thread/119496?ContentTypeID=1</link><pubDate>Wed, 20 Sep 2023 06:52:22 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ceb4f7c4-6bda-4074-8dc9-a72025a8674e</guid><dc:creator>anmolvijayvergiya</dc:creator><description>&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/16/0871.Screenshot-2023_2D00_08_2D00_23-152716.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nested CDTs and Writing Data to Database</title><link>https://community.appian.com/thread/119481?ContentTypeID=1</link><pubDate>Tue, 19 Sep 2023 15:12:32 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e86b3dad-3a11-4e0a-8364-839db6603151</guid><dc:creator>Karthi Premakumari</dc:creator><description>&lt;p&gt;Appian manages the child key automatically.&amp;nbsp; Your nested phone record could be populated in an editable grid as shown below inside your customer grid.&amp;nbsp; You will notice that nowhere the customer id (key) is being referenced.&lt;/p&gt;
&lt;p&gt;a!gridLayout(&lt;br /&gt; label: &amp;quot;Phone Records&amp;quot;,&lt;br /&gt; labelPosition: &amp;quot;ABOVE&amp;quot;,&lt;br /&gt; emptyGridMessage: &amp;quot;No records found.&amp;quot;,&lt;br /&gt; headerCells: {&lt;br /&gt; a!gridLayoutHeaderCell(label: &amp;quot;Phone Number&amp;quot;)&lt;br /&gt; },&lt;br /&gt; columnConfigs: {&lt;br /&gt; a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight: 5)&lt;br /&gt; },&lt;br /&gt; rows: a!forEach(&lt;br /&gt; items: fv!item.phoneFK, /* fv!item is your customer variable, depending on how you set it up,&amp;nbsp;it could very well be customer.phoneFK&amp;nbsp;*/&lt;br /&gt; expression: a!gridRowLayout(contents: { a!textField() })&lt;br /&gt; ),&lt;br /&gt; addRowLink: a!dynamicLink(&lt;br /&gt; label: &amp;quot;Add Phone&amp;quot;,&lt;br /&gt; saveInto: a!save(&lt;br /&gt; target: fv!item.phoneFK,&lt;br /&gt; value: append(&lt;br /&gt; fv!item.phoneFK,&lt;br /&gt; &amp;#39;type!{urn:com:appian:types:APP}PHONECDT&amp;#39;()&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt;),&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nested CDTs and Writing Data to Database</title><link>https://community.appian.com/thread/77349?ContentTypeID=1</link><pubDate>Mon, 19 Oct 2020 16:38:35 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9aea7b71-9ed8-48be-abf6-0ad7ad48848b</guid><dc:creator>gangadharr0001</dc:creator><description>&lt;p&gt;ankitt&lt;/p&gt;
&lt;p&gt;first data store entity just remove save into from input tab and in the output tab stored vales just do data pass back to PV&amp;nbsp;&lt;/p&gt;
&lt;p&gt;after that you can use script task in output tab just map first cdt primarky key to second cdt of foreign key .then you can continue with store data to second data store entity&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nested CDTs and Writing Data to Database</title><link>https://community.appian.com/thread/77330?ContentTypeID=1</link><pubDate>Mon, 19 Oct 2020 03:38:20 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d715a1af-6499-4751-9969-69a510044f2d</guid><dc:creator>Ankit Tewari</dc:creator><description>&lt;p&gt;Hi.I am facing same issue.can you please explain me how you stored the primary key of first cdt and saved it in the second data store entity.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nested CDTs and Writing Data to Database</title><link>https://community.appian.com/thread/64973?ContentTypeID=1</link><pubDate>Fri, 01 Mar 2019 17:55:45 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d72c8a55-b344-4cce-b8a6-e461ed4003a9</guid><dc:creator>meredithd0001</dc:creator><description>Yes, this post is very old and I have since solved the issue. Which essentially was using flat CDTs and manually maintaining the keys/relationships.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nested CDTs and Writing Data to Database</title><link>https://community.appian.com/thread/64965?ContentTypeID=1</link><pubDate>Fri, 01 Mar 2019 05:10:41 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b3b0b433-1d88-40d1-8758-cbd36776e0c3</guid><dc:creator>Stefan Helzle</dc:creator><description>Did you have a chance to read this: &lt;a href="https://docs.appian.com/suite/help/19.1/cdt_design_guidance.html"&gt;docs.appian.com/.../cdt_design_guidance.html&lt;/a&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nested CDTs and Writing Data to Database</title><link>https://community.appian.com/thread/64959?ContentTypeID=1</link><pubDate>Thu, 28 Feb 2019 19:35:32 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2ebcab16-c29d-4aa6-b095-3c8052488090</guid><dc:creator>lcrostarosa</dc:creator><description>Lets say you are persisting to the &amp;#96;parent&amp;#96; entity, which is a parent of &amp;#96;nest&amp;#96;with the following data:&lt;br /&gt;
&lt;br /&gt;
&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;
parent = {&lt;br /&gt;
  &amp;quot;foo&amp;quot; : &amp;quot;bar&amp;quot;,&lt;br /&gt;
  &amp;quot;nest&amp;quot;: {&lt;br /&gt;
     &amp;quot;hello&amp;quot;: &amp;quot;world&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;
&lt;br /&gt;
If you just put this data into a write to data store entity, and you have CascadeType.ALL, you should have primary keys for both, as well as a matching foreign key in the foo data&lt;br /&gt;
&lt;br /&gt;
so it will look like&lt;br /&gt;
&lt;br /&gt;
parent:&lt;br /&gt;
id: 1&lt;br /&gt;
nest_id: 1&lt;br /&gt;
foo: bar&lt;br /&gt;
&lt;br /&gt;
nest&lt;br /&gt;
id 1&lt;br /&gt;
hello: world&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nested CDTs and Writing Data to Database</title><link>https://community.appian.com/thread/64958?ContentTypeID=1</link><pubDate>Thu, 28 Feb 2019 19:28:10 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c2857a28-6021-416b-aa93-fe3d2dd61e3c</guid><dc:creator>meredithd0001</dc:creator><description>I found the same after working on it for a while. I ultimately just used a script task to grab the key from the parent CDT and input it into the child CDT. This worked great. My initial concern was that this methodology was not the correct way. However, it seems to be the cleanest method.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nested CDTs and Writing Data to Database</title><link>https://community.appian.com/thread/64957?ContentTypeID=1</link><pubDate>Thu, 28 Feb 2019 19:21:55 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:13ffe3ab-c94c-4156-9d77-6f0552f40ddd</guid><dc:creator>meredithd0001</dc:creator><description>&lt;p&gt;&lt;a href="/members/lucasc0001"&gt;lcrostarosa&lt;/a&gt;&amp;nbsp;I&amp;nbsp;may not have explained my initial question well but essentially the key linking the child CDT to my parent CDT was not populating as I expected it to. I went away from this method after researching it more extensively. I found what&amp;nbsp;&lt;a href="/members/manuelh0002"&gt;ManuelHTG&lt;/a&gt;&amp;nbsp;found, which was that it was not as easy/clean of a methodology as I initially thought it would be. I did end up just using the process model and script task functionality to grab the parent key and put it in the child CDT. This resulted in a much cleaner process and so far has enabled me to do everything I need. So for anyone looking to do something similar, it seems the best method is to just us the process model to grab the parent keys and put them into the child CDTs.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nested CDTs and Writing Data to Database</title><link>https://community.appian.com/thread/64956?ContentTypeID=1</link><pubDate>Thu, 28 Feb 2019 19:16:39 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:eecd6d30-64c1-43bc-9af0-c259f14cd9b1</guid><dc:creator>ManuelHTG</dc:creator><description>It should work if you set it up properly. You will need just to save your main CDT and the process should do the rest. I however, never do that. I find messy to handle the nested CDT&amp;#39;s and Appian at times does not manage it so well.&lt;br /&gt;
What I do is to save the key of the parent CDT on the child CDT&amp;#39;s.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nested CDTs and Writing Data to Database</title><link>https://community.appian.com/thread/64955?ContentTypeID=1</link><pubDate>Thu, 28 Feb 2019 18:22:20 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8a301d44-ce49-41c9-96f9-c24f57458056</guid><dc:creator>lcrostarosa</dc:creator><description>Im not sure I understand your question or understand where/if things are breaking.&lt;br /&gt;
&lt;br /&gt;
You can use a write to data store entity in a process or SAIL code as normal&lt;br /&gt;
&lt;br /&gt;
You will have to make sure that you are persisting per your cascade configuration as well&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>