<?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>Drop down value with Nested CDT</title><link>https://community.appian.com/discussions/f/general/21557/drop-down-value-with-nested-cdt</link><description>Hello, 
 I have a record table and a nested funding type table. The record has typical information but I normalized the database to have some sections in their own tables and nested them according to documentation. For the drop down, the choices are populated</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Drop down value with Nested CDT</title><link>https://community.appian.com/thread/84299?ContentTypeID=1</link><pubDate>Tue, 03 Aug 2021 20:05:38 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f3cb63ee-f983-436b-bb7a-21cf77830cd4</guid><dc:creator>rb0002</dc:creator><description>&lt;p&gt;Thank you. I removed the Nested CDT and worked with a flat structure and was able to create a data model in the record to mimic a database structure. I assumed that the nested CDT was mimicking that join that I expected to see in a database structure. Thank you all for your help.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Drop down value with Nested CDT</title><link>https://community.appian.com/thread/84298?ContentTypeID=1</link><pubDate>Tue, 03 Aug 2021 18:50:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:86140dad-5e55-4ff2-bfe2-4bfc4057d817</guid><dc:creator>Aparajita Singh</dc:creator><description>&lt;p&gt;I agree with Mike, Nested CDTs are a pain. Also, you can always create views or query both tables if you ever need to fetch info.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I would also like to add that you can query the data from you table and save it in a local variable and then use that local variable to index the id and value in the dropdown field. This would minimize the number of DB calls you make.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Drop down value with Nested CDT</title><link>https://community.appian.com/thread/84294?ContentTypeID=1</link><pubDate>Tue, 03 Aug 2021 14:29:01 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:30a837fe-0f26-4481-b2ad-84396e9b6b52</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;As Stefan mentioned - your CDT has the field &amp;quot;fundTypeId&amp;quot; but its data type is actually the CDT.&amp;nbsp; I have no idea why you&amp;#39;d do this.&amp;nbsp; I tend to avoid nested CDTs like this altogether, because it&amp;#39;s almost always exponentially easier to just work with flat data.&amp;nbsp; I recommend you edit your CDT and change this field to just be Integer type.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Drop down value with Nested CDT</title><link>https://community.appian.com/thread/84293?ContentTypeID=1</link><pubDate>Tue, 03 Aug 2021 14:12:38 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9a2bfe08-508f-4477-a224-8d4caa0deacf</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;First and advice. If you put the DB query twice into the component, then Appian will query that twice on each user interaction. Store the data in a local variable first, then use it in the component.&lt;/p&gt;
&lt;p&gt;Second. Using a field name like &amp;quot;&lt;span&gt;fundtypeId&amp;quot; to store a nested CDT is confusing.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Now for the solution: Change you saveInto to something like&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!save(
  target: ri!requirements.fundtypeId,
  value: rule!QUERY_FETCHING_SINGLE_ITEM(id: save!value)
)&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;should do it.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You might want to change your value field to:&amp;nbsp;ri!requirements.fundtypeId.fundtypeid.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Drop down value with Nested CDT</title><link>https://community.appian.com/thread/84292?ContentTypeID=1</link><pubDate>Tue, 03 Aug 2021 14:06:04 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:587786cc-327d-4500-8707-ab44dc9ff38c</guid><dc:creator>rb0002</dc:creator><description>&lt;p&gt;I am grabbing the fund table to create the choice labels and values, then saving the integer (fundTypeId) into the requirement table. See the below additional information&lt;/p&gt;
&lt;p&gt;The expression for the drop down&amp;nbsp; is:&lt;/p&gt;
&lt;p&gt;a!dropdownField(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; label: &amp;quot;Fund Type&amp;quot;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; labelPosition: &amp;quot;ABOVE&amp;quot;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; placeholder: &amp;quot;--- Select a Value ---&amp;quot;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; choiceLabels: {index(rule!RP_GETfundDropDown().data, &amp;quot;fundTypeName&amp;quot;, null)},&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; choiceValues: {index(rule!RP_GETfundDropDown().data, &amp;quot;fundTypeId&amp;quot;, null)},&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value: ri!requirements.fundtypeId,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; saveInto: ri!requirements.fundtypeId,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; searchDisplay: &amp;quot;AUTO&amp;quot;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; validations: {}&lt;/p&gt;
&lt;p&gt;My record format:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/11/5658.Capture.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The fundType data pulled in the rule to populate the dropdown&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/11/8473.Capture2.PNG" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Drop down value with Nested CDT</title><link>https://community.appian.com/thread/84291?ContentTypeID=1</link><pubDate>Tue, 03 Aug 2021 13:58:37 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5fe113c7-3417-4ed9-87f7-7e2b11bd1a47</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;Appian does not do this kind of things magically in the background. If you want the full &amp;quot;object&amp;quot;, then you need to query it from DB.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Drop down value with Nested CDT</title><link>https://community.appian.com/thread/84290?ContentTypeID=1</link><pubDate>Tue, 03 Aug 2021 13:57:19 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9283a4da-f7a0-462d-82f4-f9154f055d88</guid><dc:creator>Mike Schmitt</dc:creator><description>[quote userid="69574" url="~/discussions/f/general/21557/drop-down-value-with-nested-cdt/84287#84287"]Why can&amp;#39;t I just insert the FK id?[/quote]
&lt;p&gt;I&amp;#39;m not sure what you mean by this.&amp;nbsp; Are you talking about on the SAIL form?&amp;nbsp; If so, there&amp;#39;s no such thing inherently as &amp;quot;insert the FK&amp;quot;.&amp;nbsp; If your Save target is an integer, you would save the value of the selected row ID into it.&amp;nbsp; I notice you haven&amp;#39;t posted your dropdown&amp;#39;s SAIL code, so we can only but guess as to what you&amp;#39;re actually trying to do in your SaveInto.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Drop down value with Nested CDT</title><link>https://community.appian.com/thread/84287?ContentTypeID=1</link><pubDate>Tue, 03 Aug 2021 13:30:56 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2d301b01-6a3e-4886-9fe8-94467e518164</guid><dc:creator>rb0002</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;In an application, I would insert the id of the fund type into the record table and it would inherit the data from second table because of the foreign key. I have my choice labels as: {index(rule!RP_GETfundDropDown().data, &amp;quot;fundTypeName&amp;quot;, null)} and my choice values as {index(rule!RP_GETfundDropDown().data, &amp;quot;fundTypeId&amp;quot;, null)}. I am getting back an integer as expected but when I try to insert that choice into the data, it expects all of the data. I don&amp;#39;t expect it to inherently know but I would expect it to take the integer and be fine. Instead it gives me Could not cast from Number (Integer) to fundType. Details: CastInvalid&lt;strong&gt; &lt;/strong&gt;because it&amp;#39;s trying to cast the integer as an fundType CDT. Why can&amp;#39;t I just insert the FK id?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Drop down value with Nested CDT</title><link>https://community.appian.com/thread/84259?ContentTypeID=1</link><pubDate>Tue, 03 Aug 2021 06:17:54 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:791d1fe6-2db5-4f60-a4dc-5f050c2e161e</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;I understand your issue up to choiceValues. What do you mean with&lt;/p&gt;
&lt;p&gt;&amp;quot;&lt;span&gt;The goal was that I would just need to insert the id of the funding type into the record record type and it would be a reference fk. Instead, it is requiring the whole array of objects. See image. I am not entirely sure what I am doing wrong or why its expecting me to pass the whole row when it&amp;#39;s referenced as a fk. &amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The dropDown returns one of the values you give as choiceValues. It does not magically know about any record.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;What is your expectation?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>