<?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>Execute query rule in dropdown from UI values</title><link>https://community.appian.com/discussions/f/user-interface/11939/execute-query-rule-in-dropdown-from-ui-values</link><description>Hello, 
 I am trying to populate a dropdown by executing a query rule that is based on a CDT. I would need UI values to be passed as parameters to the query rule and populate dropdown dynamically when the user input value changes. Issue is the value does</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Execute query rule in dropdown from UI values</title><link>https://community.appian.com/thread/53631?ContentTypeID=1</link><pubDate>Fri, 23 Mar 2018 23:48:37 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:379a4972-e4ac-49b9-bf91-67a0102fe327</guid><dc:creator>bpmnewb</dc:creator><description>Hello &lt;a href="/members/abhayg0001"&gt;Abhay Giri&lt;/a&gt; , &lt;br /&gt;
That worked. I tried using with() as well which worked too. Thanks for your suggestion. &lt;br /&gt;
&lt;br /&gt;
Thanks&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Execute query rule in dropdown from UI values</title><link>https://community.appian.com/thread/52824?ContentTypeID=1</link><pubDate>Wed, 21 Feb 2018 13:47:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a3d1c344-aaa9-42b0-9544-86624afa2086</guid><dc:creator>bpmnewb</dc:creator><description>Hi &lt;a href="/members/abhayg0001"&gt;Abhay Giri&lt;/a&gt; , &lt;br /&gt;
Thanks. Will try that. &lt;br /&gt;
Also as the other post suggests, how do we forcefully  the value of the variables defined on load() ?&lt;br /&gt;
&lt;br /&gt;
Thanks,&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Execute query rule in dropdown from UI values</title><link>https://community.appian.com/thread/52823?ContentTypeID=1</link><pubDate>Wed, 21 Feb 2018 13:08:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b4476331-d08f-436b-9b42-39463fcbb97a</guid><dc:creator>Abhay Giri</dc:creator><description>Hi,&lt;br /&gt;
&lt;br /&gt;
It is best example of usage of  load and with function . You can also try the below way , instead of query rule i created a rule which simply contains array.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
getName rule have below :&lt;br /&gt;
&lt;br /&gt;
load(&lt;br /&gt;
&lt;br /&gt;
local!data:{{id:&amp;quot;1&amp;quot;,Name:&amp;quot;Abc1&amp;quot;},&lt;br /&gt;
{id:&amp;quot;1&amp;quot;,Name:&amp;quot;Abc2&amp;quot;},&lt;br /&gt;
{id:&amp;quot;2&amp;quot;,Name:&amp;quot;Abc3&amp;quot;},&lt;br /&gt;
{id:&amp;quot;2&amp;quot;,Name:&amp;quot;Abc4&amp;quot;},&lt;br /&gt;
{id:&amp;quot;3&amp;quot;,Name:&amp;quot;Abc5&amp;quot;},&lt;br /&gt;
{id:&amp;quot;4&amp;quot;,Name:&amp;quot;Abc6&amp;quot;},&lt;br /&gt;
{id:&amp;quot;4&amp;quot;,Name:&amp;quot;Abc7&amp;quot;}},&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
index(index(local!data,&amp;quot;Name&amp;quot;,null),wherecontains(ri!id,touniformstring(index(local!data,&amp;quot;id&amp;quot;,null))))&lt;br /&gt;
&lt;br /&gt;
  )&lt;br /&gt;
And interface will have this code :&lt;br /&gt;
&lt;br /&gt;
load&lt;br /&gt;
(&lt;br /&gt;
local!Name:null,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
  &lt;br /&gt;
  a!textField(&lt;br /&gt;
    label:&amp;quot;Endter Id&amp;quot;,&lt;br /&gt;
    value:ri!id,&lt;br /&gt;
    saveInto: &lt;br /&gt;
    {&lt;br /&gt;
      ri!id,&lt;br /&gt;
      &lt;br /&gt;
      a!save(local!Name,rule!findingNotNullAttributes(id: ri!id))&lt;br /&gt;
      &lt;br /&gt;
      &lt;br /&gt;
      &lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
  ),&lt;br /&gt;
  &lt;br /&gt;
  a!dropdownField(&lt;br /&gt;
    label:&amp;quot;Name&amp;quot;,&lt;br /&gt;
    placeholderLabel: &amp;quot;--select--&amp;quot;,&lt;br /&gt;
    choiceLabels: local!Name,&lt;br /&gt;
    choiceValues: local!Name&lt;br /&gt;
  )&lt;br /&gt;
  &lt;br /&gt;
}&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
)&lt;br /&gt;
So now in your case instead of getName, call your rule and pass the value.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Execute query rule in dropdown from UI values</title><link>https://community.appian.com/thread/52821?ContentTypeID=1</link><pubDate>Wed, 21 Feb 2018 12:55:50 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ceb235bb-de93-4de1-a78f-2aa1551ffbdf</guid><dc:creator>bpmnewb</dc:creator><description>Hello, &lt;br /&gt;
I came across this post: &lt;a href="https://community.appian.com/discussions/f/user-interface/11603/load-and-with-function-difference"&gt;community.appian.com/.../load-and-with-function-difference&lt;/a&gt;&lt;br /&gt;
which explains differences between load and with functions in UI. According to this, Variables defined in load() instantiate for only once whereas variables defined in with() will be evaluated for each interaction on form, like sort, search, input a value in field etc. However forcefully you can dynamically change the value of the variables defined on load() as well.&lt;br /&gt;
In this case, I am using local variable in load section initially and would like to get it executed dynamically when the value changes and save data into the local variable again. Is with() a better option in my case?&lt;br /&gt;
&lt;br /&gt;
Thanks,&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Execute query rule in dropdown from UI values</title><link>https://community.appian.com/thread/52820?ContentTypeID=1</link><pubDate>Wed, 21 Feb 2018 12:44:52 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d8cf26c5-a2d1-4827-9409-e2cecba487bd</guid><dc:creator>bpmnewb</dc:creator><description>Hi &lt;a href="/members/abhayg0001"&gt;Abhay Giri&lt;/a&gt; ,&lt;br /&gt;
Query rule i s supposed to take value entered (ri!expediteline.item_mfg_org_code) on the text field as input and execute the query rule that would populate another dropdown field. Below is the code for the dropdown field: &lt;br /&gt;
&lt;br /&gt;
a!dropdownField(&lt;br /&gt;
      label:&amp;quot;Mfg Ship Methods&amp;quot;,&lt;br /&gt;
      labelPosition: &amp;quot;ADJACENT&amp;quot;,&lt;br /&gt;
      placeholderLabel: &amp;quot;--- Select a Value ---&amp;quot;,&lt;br /&gt;
      choiceLabels: if(count(local!mfgShipMethods)&amp;gt;0,index(local!mfgShipMethods,&amp;quot;ship_method&amp;quot;,null),{}),&lt;br /&gt;
      choiceValues: if(count(local!mfgShipMethods)&amp;gt;0,local!mfgShipMethods.ship_method,{}),&lt;br /&gt;
      value:ri!expediteline.iso_ship_method,&lt;br /&gt;
      saveInto: ri!expediteline.iso_ship_method,&lt;br /&gt;
      validations: {}&lt;br /&gt;
    )&lt;br /&gt;
  Local variable local!mfgShipMethods is populated in the load section of the page initially: &lt;br /&gt;
&lt;br /&gt;
 local!mfgShipMethods : rule!EXP_GetMfgShipMethodsByOrg(ri!expediteline.item_mfg_org_code,ri!expediteline.mfg_source_org_code),&lt;br /&gt;
&lt;br /&gt;
I need local!mfgShipMethods executed every time when the user input ri!expediteline.item_mfg_org_code changes from UI. &lt;br /&gt;
&lt;br /&gt;
Thanks,&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Execute query rule in dropdown from UI values</title><link>https://community.appian.com/thread/52808?ContentTypeID=1</link><pubDate>Wed, 21 Feb 2018 05:58:03 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:bc65f49e-4ce5-430e-a1df-4a6fe27b9be9</guid><dc:creator>Abhay Giri</dc:creator><description>Hi bpmnewb,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
can you give more clarity on your issue. In which local variable you want to store values and which is rule ? &lt;br /&gt;
There is one rule which you are calling here : rule!EXP_GetMfgShipMethodsByOrg , what it suppose to return and take as input. I tried to implement the same thing in my machine and it worked.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If possible please provide more code.&lt;br /&gt;
&lt;br /&gt;
Regards&lt;br /&gt;
Abhay&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>