<?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>fetch Data from a db column to drop down component</title><link>https://community.appian.com/discussions/f/user-interface/12363/fetch-data-from-a-db-column-to-drop-down-component</link><description>Hi All, 
 
 I&amp;#39;m trying to fetch data form one of the column of database to the drop down component on UI. 
 Column has redundant data e.g india,india,india, in 100 rows let say. 
 I&amp;#39;m using index(local!variable,&amp;quot;columnname&amp;quot; {}) function, but it is throwing</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: fetch Data from a db column to drop down component</title><link>https://community.appian.com/thread/136770?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2024 14:58:45 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:79471183-dbab-44cf-beb4-995033385502</guid><dc:creator>Mike Schmitt</dc:creator><description>[quote userid="265396" url="~/discussions/f/user-interface/12363/fetch-data-from-a-db-column-to-drop-down-component/136761"]My requirement is to fetch unique values from DB column with the help of record type [/quote]
&lt;p&gt;FWIW, you have posted this follow-up question to an extremely old thread (from before RecordType data was even usable for your use case).&amp;nbsp; It&amp;#39;d usually be better to either find a newer thread on the subject or start your own.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fetch Data from a db column to drop down component</title><link>https://community.appian.com/thread/136764?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2024 14:39:59 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8e22186f-4994-4c1e-847e-d134e8eb425e</guid><dc:creator>Yogi Patel</dc:creator><description>&lt;div&gt;You have added a grouping clause hence in the query. Hence, it will return unique project manager names. User filter expect Facet type object. Hence, your code is correct. You need to enter your code in &amp;quot;Filter Expression&amp;quot; available in User Filters.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;See the screenshot below for reference:&lt;/div&gt;
&lt;div&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/13/Screenshot-2024_2D00_06_2D00_12-200214_5F00_1.png" /&gt;&lt;/div&gt;
&lt;div&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/13/Screenshot-2024_2D00_06_2D00_12-200243_5F00_3.png" /&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fetch Data from a db column to drop down component</title><link>https://community.appian.com/thread/136761?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2024 13:39:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9c279bd6-0511-469f-8fd9-04bb90b243aa</guid><dc:creator>Niharika</dc:creator><description>&lt;p&gt;My requirement is to fetch unique values from DB column with the help of record type to populate in dropdown values. I have used this code&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;a!localVariables(&lt;br /&gt; &lt;br /&gt; local!projectManager: a!queryRecordType(&lt;br /&gt; recordType:XYZ Record type,&lt;br /&gt; fields: a!aggregationFields(&lt;br /&gt; groupings: {&lt;br /&gt; a!grouping(&lt;br /&gt; field:&amp;nbsp;&lt;span&gt;XYZ Record type.field,&lt;/span&gt;&lt;br /&gt; alias: &amp;quot;projectManager&amp;quot;&lt;br /&gt; )&lt;br /&gt; }&lt;br /&gt; ),&lt;br /&gt; pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 5000)&lt;br /&gt; ),&lt;br /&gt; &lt;br /&gt; a!recordFilterList(&lt;br /&gt; name: &amp;quot;projectManager&amp;quot;,&lt;br /&gt; options: a!forEach(&lt;br /&gt; items: local!projectManager.data,&lt;br /&gt; expression: a!recordFilterListOption(&lt;br /&gt; id: fv!index,&lt;br /&gt; name: fv!item.projectManager,&lt;br /&gt; filter: a!queryFilter(&lt;br /&gt; field: &lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;XYZ Record type.field,&lt;/span&gt;&lt;br /&gt; operator: &amp;quot;=&amp;quot;,&lt;br /&gt; value: fv!item.projectManager&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; ),&lt;br /&gt;)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;But this returns a Facet type object which has many fields and i want to access some specific field which contains unique values&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fetch Data from a db column to drop down component</title><link>https://community.appian.com/thread/136759?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2024 13:26:19 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a26e4f91-1c18-49fb-93bd-ded8c7ec90db</guid><dc:creator>Niharika</dc:creator><description>&lt;p&gt;what is i have record type not entity&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fetch Data from a db column to drop down component</title><link>https://community.appian.com/thread/55260?ContentTypeID=1</link><pubDate>Thu, 17 May 2018 06:33:24 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:fdeb2a34-4f3f-459f-b09f-08b5ce52fa0d</guid><dc:creator>Apoorv Gangwar</dc:creator><description>Hi, &lt;br /&gt;
Follow these steps: &lt;br /&gt;
1. write query entity to fetch that column&lt;br /&gt;
2. save only that column data in a  local variable, let&amp;#39;s suppose local!a&lt;br /&gt;
3. give local!finalData: union(local!a,local!a)&lt;br /&gt;
4. use local!finalData in choiceValues and choiceLabels&lt;br /&gt;
&lt;br /&gt;
Note: 3rd step might give error saying can&amp;#39;t perform union on local!a, in this scenario write below line:&lt;br /&gt;
local!finalData: union(touniformString(local!a),touniformString(local!a))&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fetch Data from a db column to drop down component</title><link>https://community.appian.com/thread/55252?ContentTypeID=1</link><pubDate>Thu, 17 May 2018 03:31:24 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ee634cef-caa8-44b3-b886-ffd525b5b968</guid><dc:creator>nalinib0001</dc:creator><description>ok Got it ,Thanks&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fetch Data from a db column to drop down component</title><link>https://community.appian.com/thread/55251?ContentTypeID=1</link><pubDate>Thu, 17 May 2018 03:30:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:86a650b2-4930-4316-a0ac-13b58ee2e25c</guid><dc:creator>nalinib0001</dc:creator><description>Thanks for the code..&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fetch Data from a db column to drop down component</title><link>https://community.appian.com/thread/55217?ContentTypeID=1</link><pubDate>Wed, 16 May 2018 12:49:16 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2ff8a33c-8368-4dd3-b3a0-9e5c64b1dcbe</guid><dc:creator>davel001150</dc:creator><description>Yes, you don&amp;#39;t want to waste bandwidth pulling more data than you need only to remove duplicates after you&amp;#39;ve pulled.  &lt;br /&gt;
&lt;br /&gt;
Another option would be to create a constant with all the unique values, along with a Stored Procedure you can call when needed or on a schedule to update the constant to match the lookup table.  This way, you run the query say every 2 weeks instead of every single time any user goes to the form that uses the dropdown.  You need to look at how frequently this list of unique values changes.  If it&amp;#39;s not that frequent you might consider this option.  If it doesn&amp;#39;t change (every new row uses a value that has already been used before), I would do only the constant and no SP or query at all.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fetch Data from a db column to drop down component</title><link>https://community.appian.com/thread/55213?ContentTypeID=1</link><pubDate>Wed, 16 May 2018 11:42:32 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1280a131-5001-42f3-951c-b048ab7d2d93</guid><dc:creator>sureshg57</dc:creator><description>&lt;a href="/members/nalinib0001"&gt;nalinib0001&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
If you are fetching the initial data using a query entity or even calling an Stored Procedure, we can use groupby using the column which is required. This will get unique data for the column and no need to doing extra manipulation of data in Appian side. &lt;br /&gt;
&lt;br /&gt;
for ex:&lt;br /&gt;
&lt;br /&gt;
local!mydropdownlaluves:  a!queryEntity(&lt;br /&gt;
  entity: cons!MY_DATASTORE,&lt;br /&gt;
  query: a!query(&lt;br /&gt;
    aggregation: {&lt;br /&gt;
      a!queryAggregation(&lt;br /&gt;
        aggregationColumns: a!queryAggregationColumn(&lt;br /&gt;
          field: &amp;quot;MY_VALUE_COLUMN&amp;quot;,&lt;br /&gt;
          isGrouping: true()&lt;br /&gt;
        )&lt;br /&gt;
      )&lt;br /&gt;
    },&lt;br /&gt;
    pagingInfo: rule!APN_pagingInfoAll()&lt;br /&gt;
  )&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
Regards&lt;br /&gt;
Suresh&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fetch Data from a db column to drop down component</title><link>https://community.appian.com/thread/55080?ContentTypeID=1</link><pubDate>Mon, 14 May 2018 00:23:17 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5cf4f43e-7390-4c02-95ba-d29b2979fdb0</guid><dc:creator>Abhay Giri</dc:creator><description>Hi Nalini,&lt;br /&gt;
&lt;br /&gt;
I am guessing the table which you are using the populate the data in your drop down component is not lookup table. So use look up table from where these data (india,india,india,......) is coming then your drop down will work, no need to use any functions.&lt;br /&gt;
&lt;br /&gt;
But still you are facing the issue then use code suggested by Prakash with slightly change,it will give you better performance :&lt;br /&gt;
&lt;br /&gt;
load(&lt;br /&gt;
&lt;br /&gt;
local!data:index(local!variable,&amp;quot;columnname&amp;quot; {})&lt;br /&gt;
local!dropDownOptions:  union(&lt;br /&gt;
local!data,&lt;br /&gt;
local!data&lt;br /&gt;
),&lt;br /&gt;
-------&lt;br /&gt;
-------&lt;br /&gt;
------..etc,&lt;br /&gt;
a!dropdownField(&lt;br /&gt;
&lt;br /&gt;
label: &amp;quot; &amp;quot;,&lt;br /&gt;
placeholderLabel: &amp;quot;--select --&amp;quot;,&lt;br /&gt;
choiceLabels: local!dropDownOptions,&lt;br /&gt;
choiceValues:local!dropDownOptions,&lt;br /&gt;
value: {},&lt;br /&gt;
saveInto:{}&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
Regards&lt;br /&gt;
Abhay&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fetch Data from a db column to drop down component</title><link>https://community.appian.com/thread/55001?ContentTypeID=1</link><pubDate>Thu, 10 May 2018 04:44:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a667d7fa-4feb-4208-87fe-69cec9a646c3</guid><dc:creator>nalinib0001</dc:creator><description>Thanks will try it!!&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fetch Data from a db column to drop down component</title><link>https://community.appian.com/thread/55000?ContentTypeID=1</link><pubDate>Thu, 10 May 2018 04:43:45 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:70f73aa9-c1d6-437a-b68b-ce46bc33c263</guid><dc:creator>nalinib0001</dc:creator><description>Thanks will try this..&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fetch Data from a db column to drop down component</title><link>https://community.appian.com/thread/54828?ContentTypeID=1</link><pubDate>Sun, 06 May 2018 19:02:28 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b49a0b50-d330-4bf2-956b-82547746defa</guid><dc:creator>ChristineLHutchison</dc:creator><description>The values must be unique. As mentioned in the response, union will remove duplicates. However, the better approach may be to create a lookup table of values. That table should have and ID (pk) and text. The ID can be a number (sequence) for normalization or the text value. &lt;br /&gt;
If you are querying a table that just continues to grow and have more and more records, the union will start to slow and may degrade performance.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fetch Data from a db column to drop down component</title><link>https://community.appian.com/thread/54789?ContentTypeID=1</link><pubDate>Fri, 04 May 2018 11:48:26 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0eef5137-9b67-44b1-b4bc-bd8dd03ce84e</guid><dc:creator>prakashb9987</dc:creator><description>Hi Nalini ,&lt;br /&gt;
&lt;br /&gt;
 For choice values it won&amp;#39;t allow duplicate values for ignoring that&lt;br /&gt;
  can you try the bellow&lt;br /&gt;
&lt;br /&gt;
load(&lt;br /&gt;
&lt;br /&gt;
   local!data:index(local!variable,&amp;quot;columnname&amp;quot; {})&lt;br /&gt;
    -------&lt;br /&gt;
   -------&lt;br /&gt;
   ------..etc,&lt;br /&gt;
    a!dropdownField(&lt;br /&gt;
                                &lt;br /&gt;
             label: &amp;quot; &amp;quot;,&lt;br /&gt;
             placeholderLabel: &amp;quot;--select --&amp;quot;,&lt;br /&gt;
             choiceLabels: union(&lt;br /&gt;
            local!data,&lt;br /&gt;
            local!data&lt;br /&gt;
            ),&lt;br /&gt;
         choiceValues: union(&lt;br /&gt;
               local!data,&lt;br /&gt;
               local!data&lt;br /&gt;
             ),&lt;br /&gt;
           value: {},&lt;br /&gt;
          saveInto:{}&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
 may it helps you.....&lt;br /&gt;
&lt;br /&gt;
Thanks&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>