jensmin
Novice

Fill in the drop down with conditions

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,

 

 

0 Kudos
Reply
7 Replies
Themba
Apprentice

Re: Fill in the drop down with conditions

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


 


 

0 Kudos
Reply
jensmin
Novice

Re: Fill in the drop down with conditions

Hi Themba,

 

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

can you give a more specific one? 

 

Thanks,

0 Kudos
Reply
tbyrne777
Contributor

Re: Fill in the drop down with conditions

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...

0 Kudos
Reply
AAschenbrener
Apprentice

Re: Fill in the drop down with conditions

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.

 

 

0 Kudos
Reply
Widson
Apprentice

Re: Fill in the drop down with conditions

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-Dow...)


 


Regards;


Widson.

0 Kudos
Reply
Widson
Apprentice

Re: Fill in the drop down with conditions

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...)


 


Regards;


Widson.

0 Kudos
Reply
AAschenbrener
Apprentice

Re: Fill in the drop down with conditions

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.


listloadnull_3573.png
listloadwvalues_3574.png
0 Kudos
Reply