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

Dependant Dropwdowns in Gallery Resetting on max value

Hello everyone,

I am having trouble with while creating dropdowns that are dependant on each other while inside a gallery. What I want to do is have a maximum allowed option in the dropdown (10) and users can choose in steps of 1 starting from 0 but the dropdowns should never exceed 10, so that if I have 3 dropdowns, first one has 4 selected, the rest will only display 0-6, if I choose 5 in the first one, the rest will only display 0-5 and so on.

I have tried using a variable to store the rest (currentrest+selectedvalue) but sadly I could not get it working properly.

Is there any practicable way to accomplish this when using a gallery?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Thanks for your help, sadly this did not work.

I have now removed the dependancy of the dropdowns from a global variable and allow users to enter any number while only checking if the sum is <>1 before patching. This seems to be the better solution usability wise in my case anyways.

 

View solution in original post

5 REPLIES 5
Highlighted
Community Support
Community Support

Hi @schredder07 

Could you please share the items property of Dropdown?

I just a made a test, hope this helps.

1. set Dropdown1 Items property: 

 

[1,2,3,4,5,6,7,8,9,10]

 

2. set Dropdown2 Items property: 

 

Filter([1,2,3,4,5,6,7,8,9,10],Value <= 10-DropDown1.Selected.Value)

 

If the Dropdown1 selects 6, the Dropdown2 would only list 0-4. 

Snipaste_2020-02-27_17-18-28.png

 

Sik

 

Highlighted

Thank you for your reply. I have tried your solution, but I cannot get it working properly inside a gallery. Outside of a gallery with a static amount of dropdowns your solution seems great, but the values have to be changed after every change which I tried like this:

 

 

OnChange:
UpdateContext({RestValue:Sum(10,Sum(TimeSheetGallery.AllItems,-Dropdown1.Selected.Value))});

 

And while RestValue displays correctly, I can't seem to get the correct values displayed inside my dropdowns after selecting different values.

 

 

 

Highlighted

Hi @schredder07 ,

 

Some question:

Could you please show more details with your scenario? What are the Items of the first dropdown? what field does the dropdown link to?

 

OK. Do you mean this?

GIF_38.gif

 
You want to save the selected values as variables, but it's hard to apply for your case - in a gallery.
My idea is to store the selected values in the 'SelectedValue' field of each row, and then get the sum of the selected values of the previous rows in the fixed order(by "OrderID") to determine the range of values available for the current combobo box.
 

First to create a new column 'SelectedValue', and create a new column "OrderID" to store the sequence number of the current rows, just like the ID column in an SP list.

1. use AddColumns function to create a new column "SelectedValue", and save to collection

 

ClearCollect(MyCol1,SortAddColumns('SP list',"SelectedValue",""))

 

2. set Items property of combo box as below, each combo box shows different Items based on the values you selected in the first few rows, I use Sum and Filter function to get the sum of all SelectedValues you selected earlier.

 

Filter([1,2,3,4,5,6,7,8,9,10],Value<= 10-Sum(Filter(MyCol1,ID<ThisItem.ID),SelectedValue))

 

3. set OnChange property of combo box, save the selection to SelectedValue field

 

Patch(MyCol1,ThisItem,{SelectedValue:ComboBoxNme.Selected.Value})

 

 4. set DefaultSelectedItems property:

 

{Value:ThisItem.SelectedValue}

 

 Hope this helps.

Sik

Highlighted

Thanks for your help, sadly this did not work.

I have now removed the dependancy of the dropdowns from a global variable and allow users to enter any number while only checking if the sum is <>1 before patching. This seems to be the better solution usability wise in my case anyways.

 

View solution in original post

Highlighted

Hi @schredder07 

 

Glad to see you find the most suitable workaround.

Could you mark your post as the answer? it would help other members find it quickly and end this thread.

Sik

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (9,980)