<?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>Populate PickerfieldCustom  from a CDT</title><link>https://community.appian.com/discussions/f/new-to-appian/19694/populate-pickerfieldcustom-from-a-cdt</link><description>I&amp;#39;m fairly new to Appian so any help is greatly appreciated. 
 I found this example on how to populate a PickerfieldCustom with static data but I&amp;#39;m wanting to use a table from a database via a CDT. 
 The table has 2 columns (id, descr). I already created</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Populate PickerfieldCustom  from a CDT</title><link>https://community.appian.com/thread/77066?ContentTypeID=1</link><pubDate>Fri, 09 Oct 2020 07:18:16 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e6140a10-dde2-4f92-8eda-5ee8c61dddb5</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;Just to add one more thing. In case you can choose from a large amount of items, it is not a good idea to load all into memory and pass them into the suggest function. In this case you should implement a dynamic query from DB inside the suggest function.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Populate PickerfieldCustom  from a CDT</title><link>https://community.appian.com/thread/77047?ContentTypeID=1</link><pubDate>Thu, 08 Oct 2020 18:29:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2a255b45-efe4-42a8-b078-eb542b0efbe9</guid><dc:creator>htmoore</dc:creator><description>&lt;p&gt;That did the trick! Thank you! With a little&amp;nbsp;tweak it worked great. Had to add touniformstring() in the wherecontains() but other than that, it is working as expected.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks Peter, st07, and sandeepd. :-)&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s the final code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!pickerFieldCustom(
    label: &amp;quot;Select Faculty Advisor&amp;quot;,
    labelPosition: &amp;quot;ABOVE&amp;quot;,
    instructions: &amp;quot;Search for Faculty Advisor by name or employee Id&amp;quot;,
    placeholder: &amp;quot;Enter names here&amp;quot;,
    maxSelections: 1,
    suggestFunction: rule!ADA_LookupAdvisorsFilter(
      filter: _,
      labels: local!data.name,
      identifiers: local!data.emplid
    ),
    selectedLabels: a!forEach(
      items: local!selection,
        expression:
      index(local!data.name, 
        wherecontains(
          fv!item,
          touniformstring(local!data.emplid)
        )
      )
    ),
    saveInto: local!selection,
    value: local!selection
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Populate PickerfieldCustom  from a CDT</title><link>https://community.appian.com/thread/77008?ContentTypeID=1</link><pubDate>Thu, 08 Oct 2020 05:08:06 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2cda2178-3c0a-4cf7-b8ba-5728393cebae</guid><dc:creator>Shikha</dc:creator><description>&lt;p&gt;Hey , please add .data at the end of your query entity (line 25) ADA_lookupadvisors so that it gives you data in dictionary type format ( excluding startIndex, totalcount , batchsize etc) . Alternatively , In the interface, you can define the local&amp;nbsp; variable like this :&amp;nbsp;local!data : rule! ADA_lookupadvisors().data.&amp;nbsp; You can try any of the above two methods. That should work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Populate PickerfieldCustom  from a CDT</title><link>https://community.appian.com/thread/77006?ContentTypeID=1</link><pubDate>Thu, 08 Oct 2020 02:51:10 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3cbb1ed2-7f8b-4c8d-aa96-f81a5f1b927e</guid><dc:creator>htmoore</dc:creator><description>&lt;p&gt;Hi Peter,&lt;/p&gt;
&lt;p&gt;First off, love you training videos. They are very helpful. Keep up the good work!&lt;/p&gt;
&lt;p&gt;I think I&amp;#39;m close but seems that I&amp;#39;m not quite there yet. Seems to be a problem in the selectedLabels, specifically the forEach expression. I&amp;#39;ll attach some screenshots. Maybe you guys can spot something I&amp;#39;m overlooking.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/62/2020_2D00_10_2D00_07_5F00_21_2D00_32_2D00_35.png" /&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/62/2020_2D00_10_2D00_07_5F00_21_2D00_35_2D00_14.png" /&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/62/2020_2D00_10_2D00_07_5F00_21_2D00_39_2D00_26.png" /&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/62/3666.2020_2D00_10_2D00_07_5F00_21_2D00_37_2D00_29.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Populate PickerfieldCustom  from a CDT</title><link>https://community.appian.com/thread/76978?ContentTypeID=1</link><pubDate>Wed, 07 Oct 2020 11:55:30 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8666ea92-c115-4ebb-8b5f-a78571ce35d6</guid><dc:creator>Peter Lewis</dc:creator><description>&lt;p&gt;The easiest way to set this up with data from a database is to create a query that returns all of the data from your CDT. Then, just replace the &amp;quot;labels&amp;quot; list with your description and the &amp;quot;abbreviations&amp;quot; list with your id. Keep in mind you might need to also change some of the data types for your supporting rule (for instance, the &amp;quot;identifiers&amp;quot; rule input should be an integer instead of text). If you do this correctly, your final expression could look something like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!selection,
  local!data: rule!GetAllReferenceData(),
  a!pickerFieldCustom(
    label: &amp;quot;Label&amp;quot;,
    instructions: &amp;quot;Value saved: &amp;quot; &amp;amp; local!selection,
    maxSelections: 1,
    suggestFunction: rule!ucArrayPickerFilter(
      filter:_ , 
      labels: local!data.desc, 
      identifiers: local!data.id
    ),
    selectedLabels: a!forEach(
      items: local!selection,
      expression: index(local!data.desc, wherecontains(fv!item, local!data.id))
    ),
    value: local!selection,
    saveInto: local!selection
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Populate PickerfieldCustom  from a CDT</title><link>https://community.appian.com/thread/76959?ContentTypeID=1</link><pubDate>Wed, 07 Oct 2020 05:13:06 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:44cddf06-e264-466b-bb29-d4227863e3f8</guid><dc:creator>sandeepd</dc:creator><description>&lt;p&gt;&lt;a href="/members/hiltonm0001"&gt;htmoore&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Below code may help you.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;a!pickerFieldCustom(&lt;br /&gt; label: &amp;quot;Select Data&amp;quot;&lt;br /&gt; placeholder: &amp;quot;Type Min 3 characters&amp;quot;,&lt;br /&gt; labelPosition: &amp;quot;JUSTIFIED&amp;quot;,&lt;br /&gt; required: true(),&lt;br /&gt; maxselections: 1,&lt;br /&gt; suggestFunction: ##Write Expression rule to get ID &amp;amp; Desc Data from Data base# Use index function to get data index. Also, in Query entity Filter use operator: &amp;quot;includes&amp;quot; ##&lt;br /&gt; selectedLabels: index(&lt;br /&gt; rule!getDetailsByID(&lt;br /&gt; Id_int: local!selectedId&lt;br /&gt; ),&lt;br /&gt; &amp;quot;Desc&amp;quot;,&lt;br /&gt; null&lt;br /&gt; ), #Here get details from table by passing Id #&lt;br /&gt; value: local!selectedId,&lt;br /&gt; saveInto: {&lt;br /&gt; local!selectedId,&lt;br /&gt; )&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;br /&gt;Sandeep&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>