cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Heliooso
Helper I
Helper I

Sort by dropdown descending

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.

1 ACCEPTED SOLUTION

Accepted Solutions
v-xiaochen-msft
Community Support
Community Support

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.

v-xiaochen-msft_0-1613094715146.png

 

 

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:

v-xiaochen-msft_1-1613094715158.png

 

v-xiaochen-msft_2-1613094715173.png

 

 

Best Regards,

Wearsky

If my post helps, then please consider Accept it as the solution to help others. Thanks.

View solution in original post

6 REPLIES 6
rubin_boer
Super User
Super User

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?

Heliooso
Helper I
Helper I

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.

v-xiaochen-msft
Community Support
Community Support

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})

v-xiaochen-msft_0-1612949704273.png

 

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:

v-xiaochen-msft_1-1612949704275.png

 

v-xiaochen-msft_2-1612949704276.png

 

v-xiaochen-msft_3-1612949704278.png

 

 

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"]

v-xiaochen-msft
Community Support
Community Support

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.

v-xiaochen-msft_0-1613094715146.png

 

 

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:

v-xiaochen-msft_1-1613094715158.png

 

v-xiaochen-msft_2-1613094715173.png

 

 

Best Regards,

Wearsky

If my post helps, then please consider Accept it as the solution to help others. Thanks.

View solution in original post

Works awesome, Thank You! 

 

It was great that you pointed out that price and quantity are number columns, I had them on text before.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

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
Top Kudoed Authors
Users online (2,377)