Hello,
Is it possible to sort my inventory with the dropdown box ? I have 3 columns in excel: Name,Price,Quantity. I would like to be able to select those from the dropdown to sort my inventory in descending order. I have searched everywhere for this to no avail.
Solved! Go to Solution.
Hi @Heliooso ,
I used list as a data source and did a test for you.
1\ This is my list ‘LIST71’. ‘NAME’ is a Single line of text column. ’Price’ is a number column. ‘Quantity’ is a number column.
2\ Add a dropdown control and set its Items property to:
["Name","Price","Quantity"]
3\ Add a gallery control and set its Items property to:
If(Dropdown1.Selected.Value="Name",SortByColumns(LIST71,"NAME",Descending),Dropdown1.Selected.Value="Price",SortByColumns(LIST71,"Price",Descending),Dropdown1.Selected.Value="Quantity",SortByColumns(LIST71,"Quantity",Descending))
4\ The result is as follows:
Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.
hi @Heliooso when you say you wish to sort the inventory, can you give more detail. you can sort on those three columns, Name, Price and Quantity. when you select Grapes, what is it you want to see in the gallery?
Hi @rubin_boer , thank you for the quick reply.
I would like to sort the inventory by price for example. So that when I select price from the dropdown it would be sorted by price. Is that possible ?
So the idea is that you would have to option to select how to sort, not by a button but with a dropdown.
Hi @Heliooso ,
According to your description, I use a collection to do a test for you.
1\ This is my test collection ‘Test’. Add a button control and set its OnSelect property to:
ClearCollect(Test,{Name:"Apples",Price:100,Quantity:800},{Name:"Oranges",Price:350,Quantity:15},{Name:"Grapes",Price:150,Quantity:4},{Name:"Pineapple",Price:600,Quantity:10},{Name:"Melon",Price:1.5,Quantity:23})
2\ Add a dropdown control ‘Dropdown1’ and set its Items property to:
["Name","Price","Quantity"]
3\ Add a gallery control and set its Items property to:
SortByColumns(Test,Dropdown1.Selected.Value,Descending)
4\ The result is as follows:
Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.
Hi @v-xiaochen-msft , I understand you used a collection to illustrate this ? It's still not sorting correctly when im using my sharepoint list, the only this it's sorting the way I want it to is price, in descending order that is. Quantity is just sorting randomly and name/title is sorting in ascending order.
Gallery items property: SortByColumns(InvTest,Dropdown1.Selected.Value,Descending)
Dropdown items property: ["Title","Price","Quantity"]
Hi @Heliooso ,
I used list as a data source and did a test for you.
1\ This is my list ‘LIST71’. ‘NAME’ is a Single line of text column. ’Price’ is a number column. ‘Quantity’ is a number column.
2\ Add a dropdown control and set its Items property to:
["Name","Price","Quantity"]
3\ Add a gallery control and set its Items property to:
If(Dropdown1.Selected.Value="Name",SortByColumns(LIST71,"NAME",Descending),Dropdown1.Selected.Value="Price",SortByColumns(LIST71,"Price",Descending),Dropdown1.Selected.Value="Quantity",SortByColumns(LIST71,"Quantity",Descending))
4\ The result is as follows:
Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.
Works awesome, Thank You!
It was great that you pointed out that price and quantity are number columns, I had them on text before.
User | Count |
---|---|
160 | |
94 | |
81 | |
74 | |
58 |
User | Count |
---|---|
195 | |
169 | |
99 | |
95 | |
79 |