cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BGuinn
Frequent Visitor

Change combo box Item source using a Variable

I'm trying to use a single form to handle multiple customer lists based on what Region is selected.

I'm wondering if I can dynamically change the item source based on a previous dropdown

 

Like concatenating two strings to create a reference to a source name

 

BGuinn_0-1600393889624.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaulD1
Super User
Super User

You can change a filter predicate dynamically - so if all your data were in one table and you had a column for the Region, you could do:

Items:  Filter(tblSales, SalesRegion = varSalesRegion)

 

You cannot specify the table with Sales_ & var_Reg. PowerApps evaluates everything 'on the fly' for the App Checker and intellisense won't be able to figure out what datasource you want and so what fields should be listed unless you explicitly specify the table you want to use.

You might want to try, in the onchange of your first combo something like:

If(First(cboReg.Selected.Items).Reg = "SouthReg", set(varReg, SalesRoute_SouthReg))

Where SalesRoute_SouthReg is actually the table.

And then just use varReg for the Items property. I have one similar for the Items property of a Datatable but that was just for a quick 'utility' that only I was ever going to use - I wouldn't trust that in a Production system.

I would be especially wary of using this technique with combos as, in my experience, they are quite finicky about the data source and if you change it, you might find you lose your parameters for the Display and Search fields.

 

Safer would be to have multiple combos, one for each region, and base their visible property on the chosen regions.

Better still would be to normalise your sales data so that it is in a single table with a field for 'Region' (instead of being split across multiple tables, one for each region) and then use a filter to get the appropriate subset of data.

View solution in original post

2 REPLIES 2
PaulD1
Super User
Super User

You can change a filter predicate dynamically - so if all your data were in one table and you had a column for the Region, you could do:

Items:  Filter(tblSales, SalesRegion = varSalesRegion)

 

You cannot specify the table with Sales_ & var_Reg. PowerApps evaluates everything 'on the fly' for the App Checker and intellisense won't be able to figure out what datasource you want and so what fields should be listed unless you explicitly specify the table you want to use.

You might want to try, in the onchange of your first combo something like:

If(First(cboReg.Selected.Items).Reg = "SouthReg", set(varReg, SalesRoute_SouthReg))

Where SalesRoute_SouthReg is actually the table.

And then just use varReg for the Items property. I have one similar for the Items property of a Datatable but that was just for a quick 'utility' that only I was ever going to use - I wouldn't trust that in a Production system.

I would be especially wary of using this technique with combos as, in my experience, they are quite finicky about the data source and if you change it, you might find you lose your parameters for the Display and Search fields.

 

Safer would be to have multiple combos, one for each region, and base their visible property on the chosen regions.

Better still would be to normalise your sales data so that it is in a single table with a field for 'Region' (instead of being split across multiple tables, one for each region) and then use a filter to get the appropriate subset of data.

View solution in original post

BGuinn
Frequent Visitor

@PaulD1 Yep, that sounds about right. I had seen some older posts using the switch function to manipulate the source. I was trying to get around some of the sharepoint constraints. My customer list is 240,000 customers and that exceeds the sharepoint limits of >50mb limit of sharepoint upload and >20,000 rows. 

 

Since I'm new, I was looking for ways around those sharepoint list limits by splitting the source. Thanks for the info.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,494)