cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rsparks
Level: Powered On

Filter displayed choices in a combo-box based on a separate drop-down

Looking at others who've asked a similar question, my scenario seems to be a bit different. 

 

I have a combobox that I want to display vehicle accessories depending on what vehicle type is selected.

 

Here is the table with the accessory values per vehicle:

 

vehicle costs.PNG

 

And the form:

 

form.PNG

 

So if the user selects small hatch, ideally they wouldn't be able to select Towbar as an option in the combobox. Though this isn't critical. The main functionality I need is to pull the specific cost of each selected optional extra from that list, to be used in a Sum further down. So if they selected first aid kit and rubber mats, the cost will add on 250.

 

The Sum is just adding up the costs of everything the user has selected (based on vehicle and lease length). Currently I just have a list with 1 amount for each accessory being used for all vehicles, which isn't very accurate for budgeting (which is the purpose of the form). The estimate will either be too high or too low. 

3 REPLIES 3
yapper
Level: Powered On

Re: Filter displayed choices in a combo-box based on a separate drop-down

Hello @rsparks ,

If I understand you correctly, you want the user to be able to choose specific extras based on the type of car they select.
To do this:

  1. You will need some kind of table with cars and available packages
    1. See the OnSelect property of the Button in the Sample App for one such schema.
  2. Then you need a way to display the specific extras for the chosen vehicle
    1. See the Items property of the Gallery control
  3. You'll also need a way for users to select 0 or N (all) extra packages. I'd suggest checkboxes in a Gallery control for this.
    1. See the OnCheck and OnUncheck properties of the CheckBox control for some goodies here.
  4. Finally to tally the total, you'll need a label which sums the costs.
    1. See the TextBox Text property for this goodie.

Peek 2019-10-14 22-21.gif

See attached SampleApp and study the concepts lined out.

Hope this helps you learn PowerApps!

rsparks
Level: Powered On

Re: Filter displayed choices in a combo-box based on a separate drop-down

Using that table layout you've provided, I've made a list in Sharepoint that has 3 columns. Vehicle Type, Option and Cost.

 

Rather than managing the table within powerapps, I'd rather do it in Sharepoint so that I can share access (and as such pass maintanence of the table to someone else). How would I go about using filters to recreate the same functionalities that your app has?

 

I need the choice combobox to filter the Option column based on the Vehicle Type selected in a dropdown further up in the app. I'm not quite sure how to do that for a choice function, but I imagine it would something along the lines of embedding the Filter within the Choice. 

 

Then for summing the costs of each Option I would have to repurpose this function:

 

Round(((Sum(Filter('Optional Extra Costs',OptionalExtraName in ComboBox2.SelectedItems.Value),OptionalExtraCost))/Dropdown10.Selected.Val), 0)

 

Any suggestions for getting the Choice combobox working based on a Sharepoint list rather than a table set up as a collection?

 

 

rsparks
Level: Powered On

Re: Filter displayed choices in a combo-box based on a separate drop-down

Nevermind, copied over your collection, gallery and checkbox ideas. Works very well. 

 

2 more questions, first is how do I patch the "Goodies" data to my Extras column in a list?

 

The old function I had was {'Optional Extras Package': Left(Concat(colMyItems, Value & ", "), Len(Concat(colMyItems, Value & ", "))-2)}.

 

Should I simply replace colMyItems with colCarsOptions?

 

Second, how do I make the gallery/datacard resize themselves based on how many choices are visible? As below, it doesn't look great with all the empty space if you're looking at a small hatch.

 

1.PNG2.PNG

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,761)