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?

hey there if you liked the post give it a thumbs up, and if it solved your question please accept it as a solution.
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.

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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Check out the New Ideas Site

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (3,096)