<?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>Determining the different options of a pull-down menu from a database entity?</title><link>https://community.appian.com/discussions/f/user-interface/20809/determining-the-different-options-of-a-pull-down-menu-from-a-database-entity</link><description>I am trying to populate the values of a pull-down menu from a database. For this purpose, I defined cons!GENERIC_TASKS which points to corresponding database entity. I also have the following expression rule which reads all necessary data from the respective</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Determining the different options of a pull-down menu from a database entity?</title><link>https://community.appian.com/thread/81105?ContentTypeID=1</link><pubDate>Thu, 22 Apr 2021 11:55:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5b0660e1-eab4-4d26-80f6-59bf3ff06e00</guid><dc:creator>fgrl</dc:creator><description>&lt;p&gt;Thanks for all the hints! I will use more local variables now.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Determining the different options of a pull-down menu from a database entity?</title><link>https://community.appian.com/thread/81086?ContentTypeID=1</link><pubDate>Wed, 21 Apr 2021 16:15:10 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f208e7f5-2f87-4f5a-af1b-08e0f296a77a</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Additionally, the way you&amp;#39;re trying to refer to &amp;quot;identifiers&amp;quot; won&amp;#39;t work.&amp;nbsp; &amp;quot;Identifiers&amp;quot; is not a sub-property of &amp;quot;.data&amp;quot;, but instead a property of the query result (i.e. the data subset returned by a!queryEntity).&lt;/p&gt;
&lt;p&gt;I suggest that instead of trying to mess with &amp;quot;identifiers&amp;quot;, just include the primary key field in the list of columns you&amp;#39;re including in your a!querySelection(); then you can refer directly to the primary key field by its field name instead of trying to use &amp;quot;.identifiers&amp;quot;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Determining the different options of a pull-down menu from a database entity?</title><link>https://community.appian.com/thread/81085?ContentTypeID=1</link><pubDate>Wed, 21 Apr 2021 16:12:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b594cd71-df55-4751-90f6-8c100aa33e01</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Why are you running the same query twice, once for choiceLabels and once for choiceValues?&amp;nbsp; That seems pretty inefficient.&lt;/p&gt;
&lt;p&gt;Instead you should be doing something like this, querying just once into a local variable and then referring to that subsequently.&lt;br /&gt;&lt;pre class="ui-code" data-mode="java"&gt;a!localVariables(
  local!taskNames: rule!APAS_GetAllGenericTaskNames().data,
  
  a!dropdownField(
    label: &amp;quot;Generic step type&amp;quot;,
    labelPosition: &amp;quot;ABOVE&amp;quot;,
    placeholder: &amp;quot;--- Please choose a step type ---&amp;quot;,
    choiceLabels: local!taskNames.genericTaskName,
    choiceValues: local!taskNames.identifiers,
    saveInto: {},
    searchDisplay: &amp;quot;AUTO&amp;quot;,
    validations: {}
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;As an aside: you&amp;#39;ve posted code a few different ways above, but I universally recommend using the &amp;quot;Code Box&amp;quot; i&amp;#39;ve used here.&amp;nbsp; For reference:&lt;br /&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/13/pastedimage1619021474202v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Determining the different options of a pull-down menu from a database entity?</title><link>https://community.appian.com/thread/81057?ContentTypeID=1</link><pubDate>Wed, 21 Apr 2021 12:11:26 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6cafff8e-2a70-408e-bc2f-e2d893b2643d</guid><dc:creator>Arun Dubey</dc:creator><description>&lt;pre&gt;&lt;strong&gt;choiceValues: {rule!APAS_GetAllGenericTaskNames.data.identifiers}&lt;br /&gt;Why are you using identifiers ?&lt;br /&gt;I don&amp;#39;t know your use case but if you are trying to store or display then use same for both &lt;br /&gt;choiceLabels and choiceValues.&lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;strong&gt;choiceLabels: {rule!APAS_GetAllGenericTaskNames().data.genericTaskName},&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; choiceValues: {rule!APAS_GetAllGenericTaskNames().data.&lt;/strong&gt;&lt;strong&gt;genericTaskName&lt;/strong&gt;&lt;strong&gt;},&lt;/strong&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Determining the different options of a pull-down menu from a database entity?</title><link>https://community.appian.com/thread/81056?ContentTypeID=1</link><pubDate>Wed, 21 Apr 2021 12:03:25 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:fe1442af-cdb3-4119-87ff-25159e4cdef5</guid><dc:creator>fgrl</dc:creator><description>&lt;p&gt;I still receive an error:&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#ff0000;"&gt;&lt;strong class="StrongText---richtext_strong StrongText---inMessageLayout StrongText---error"&gt;Could not display interface. Please check definition and inputs.&lt;/strong&gt; Interface Definition: Expression evaluation error at function a!dropdownField [line 19]: A dropdown component [label=&amp;ldquo;Generic step type&amp;rdquo;] has an invalid value for &amp;ldquo;choiceValues&amp;rdquo;. Choice values cannot be null.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#000000;"&gt;This is curious, because I explicitly neither allowed null-values in the column &lt;strong&gt;genericTaskName&lt;/strong&gt; of underlying database table, nor are there any null-values in the table.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#000000;"&gt;The types seem to fit, at least when testing the expression rule.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Determining the different options of a pull-down menu from a database entity?</title><link>https://community.appian.com/thread/81054?ContentTypeID=1</link><pubDate>Wed, 21 Apr 2021 11:54:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c82edd81-9ca7-42e8-af70-dd28d2f5abff</guid><dc:creator>Arun Dubey</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I think you are missing () while calling the rules.&lt;/p&gt;
&lt;pre&gt;&lt;strong&gt;choiceLabels: {rule!APAS_GetAllGenericTaskNames().data.genericTaskName},&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; choiceValues: {rule!APAS_GetAllGenericTaskNames().data.identifiers},&lt;/strong&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>