cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Super User
Super User

Re: Change combo box Item source using a Variable

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
Highlighted
Super User
Super User

Re: Change combo box Item source using a Variable

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

Highlighted
Frequent Visitor

Re: Change combo box Item source using a Variable

@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
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,899)