cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Re: Combobox filtering different lists based on the value before

Hi Warren,

 

I've created the collection as you said but the last step doesn't work.. I want to filter the Division (it's a column in the lists) but when I use the your last formula there's nothing to select. 

What am I doing wrong? 

Highlighted
Community Champion
Community Champion

Re: Combobox filtering different lists based on the value before

Hi @VS123 ,

I have to date been addressing your original issue with this formula

Distinct(Filter(If(CountryLabel.Text = 'Indonesia', 'Prices Indonesia', 'Prices Thailand'), CountrySystem = CountryLabel.Text).Division, Division)

The last step of the process I suggested will get you the correct "Prices xxxx" for the user.

So, is Division in the same list as 'Prices xxxxx' and you want a list of the matching Division entries for the User's Country?

 

 

 

Highlighted
Microsoft
Microsoft

Re: Combobox filtering different lists based on the value before

Hi @VS123 , as the indonesia and thailand lists are created by you, we suggest you remove the duplication before creating the lists.

 

but if you insist, you may still distinct the value in powerapps as below formular:

 

Switch(TextInput1.Text,"in",Distinct(Indonesia,Title),"th",Distinct(Thailand,Title))

Title is the column name, should be replaced with yours

Highlighted
Helper I
Helper I

Re: Combobox filtering different lists based on the value before

I can't avoid the duplication, as the same division consists of multiple systems, which I want to filter in the second box. 

I attached a screenshot of the Thailand list to make it more clear (every country list will look like that).

 

So in the first box I want to filter the Division (A or B) from a list which will be based on the user's country.

In the second box I want to filter based on the Division selected in box 1 the system. 

As last step there will appear charts with the Prices for the different types of the selected system.

 

 

 

 

 

Highlighted
Helper I
Helper I

Re: Combobox filtering different lists based on the value before

Yes exactly!

Highlighted
Community Champion
Community Champion

Re: Combobox filtering different lists based on the value before

Hi @VS123 ,

Just let me know if you are happy to follow the path suggested by @Michael_Shen_JT 

Highlighted
Helper I
Helper I

Re: Combobox filtering different lists based on the value before

The first ComboBox with the distinct and switch is working, just now I'm facing the problem that I want to use the list I used for this ComboBox again in the next ComboBox where I want to filter based on the selected Division. Using the switch function again in the filter function is not working.

 

I've tried following:

Distinct(Filter(Switch(CountryLabel.Text, "Indonesia", 'IB Pricelist'.Division, "Thailand", 'Prices Thailand'.Division), Division = ComboBoxBusinessLine_3.Selected.Result), System)

Highlighted
Community Champion
Community Champion

Re: Combobox filtering different lists based on the value before

Hi @VS123 ,

If you break your code down, you may see the issue.

Distinct(
   Filter(
      Switch(
         CountryLabel.Text, 
         "Indonesia", 
         'IB Pricelist'.Division, 
         "Thailand", 
         'Prices Thailand'.Division
      ), 
      Division = ComboBoxBusinessLine_3.Selected.Result
   ),
   System
)

You need to go from the inside out - so looking at the Switch, the two possible results are

  • 'IB Pricelist'.Division
  • 'Prices Thailand'.Division

Going with the first one for instance, your formula becomes

Distinct(
   Filter(
      'IB Pricelist'.Division,  
      Division = ComboBoxBusinessLine_3.Selected.Result
   ),
   System
)

You are filtering a field instead of a list - I think it should be

Distinct(
   Filter(
      'IB Pricelist',  
      Division = ComboBoxBusinessLine_3.Selected.Result
   ),
   System
)

So the end result would be

Distinct(
   Filter(
      Switch(
         CountryLabel.Text, 
         "Indonesia", 
         'IB Pricelist', 
         "Thailand", 
         'Prices Thailand'
      ), 
      Division = ComboBoxBusinessLine_3.Selected.Result
   ),
   System
)

I have not revisited anything else on this - I just thought this might help

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (8,659)