Fill in the drop down with conditions

  • 19 October 2018
  • 7 replies
  • 123 views

Hi All,

 

 

How to fill in the dropdownlist from the SmartObject that has the condition?

for example, SELECT * FROM table_user WHERE Role = 'admin';

so all the dropdowns are users who have admin roles.

 

Thanks,

 

 


7 replies

Userlevel 2

Hi Jensmin,


 


You can filter data using the "Filter the data according to another control's value", please see below documentation for more information.


 


Kind regards


 


 

Hi Themba,

 

I can't find "Filter the data according to another control's value"rules, 

can you give a more specific one? 

 

Thanks,

Userlevel 5
Badge +13

When you set the data source for your drop down, K2 automatically adds a "populate dropdown with data" rule to your view Initialize rule. If you look at the settings of this rule, there is a tab for "filter" where you can specify your filter rules on the data that is being populated into your dropdown. I hope this helps...

Badge +10

Has anybody else been having problems with Joined Properties?   
Especially when using the 'Allow Empty Selection' option?

I have 3 Drop Downs:
Region (Region ID)
Group (Linked to RegionID)
Facility (Linked to GroupID)

If I have the 'Allow Empty Selection' checked and have then filtered in the SmartObject Data Source by IDs,  if you select the 'NULL' value - the drop downs don't blank out -  they go to a 'select all' type leaving all the records visible.

 

 

Good day  @AAschenbrener;


 


For encoding issue related to drop-down list control, please see the best recommendations here(https://community.k2.com/t5/K2-blackpearl-Articles/Issue-with-rule-which-uses-comparison-of-Drop-Down-list/ta-p/79483)


 


Regards;


Widson.

Hi  @jensmin;


 


Please check with this community post on similar issue was resolved by our legitimate designer(https://community.k2.com/t5/K2-Blackpearl-Forum-Posts/How-to-filter-drop-down-list-controls-if-there-is-no/td-p/101912)


 


Regards;


Widson.

Badge +10

I appreciate the links -  however my issue is not populating the lists with a link from one to the other. 

 

My issue is that when you have the check box for 'Allow Empty Selection' checked off -  just for the purpose of have the 'Select an item' text visible it does not clear the results from the original selections.

 

This scenario is working:

Region (1st Drop Down) -  Select Region with ID 1. ID 1 is transferred to my 2nd Drop Down of Group as input / filter.

Group (2nd Drop Down) - Filtered down to Groups with Region ID 1.  User selects a Group with an ID of 2. ID 2 is transferred to my 3rd Drop Down of Facilities as input/filter.

Facility (3rd Drop Down) - Filtered down to all Facilities with Group ID 2.


This scenarios is not working:

Group (2nd Drop Down) - you select the empty result / null value that is the 1st option (not from my SMO but K2s built in 'Empty Value') - it does not clear any of my drop downs and runs a select * and shows everything.

I'm attaching a screenshot that points out the empty result I'm speaking of.  

In a normal situation people wouldn't select that value - HOWEVER - my QAs are and I need to find the solution that clears out my other drop downs in this event.



Reply