cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tagustin2020
Impactful Individual
Impactful Individual

Sort prizes alphabetically by the name of the gift card, not the amount

@RandyHayes 

 

Hello,

 

I have a gallery of prizes. I would like them to sort in alphabetical order, but as you can see they are alphabetizing by prize amount. I imagine the Split function might be the way forward on this, but I'm not sure how to do it so it works dynamically. I have quite a few prizes divided up by different shift parties. Could someone help me out?

 

To be clear, I would like them to sort like this:

$50 Amazon Gift Card

$50 Best Buy Gift Card

$25 Powell's Gift Card

etc.

 

Thank you.

 

PrizeGallerySorting.png

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@tagustin2020 

Hi again! 

Sure thing...do all the prizes start with a dollar value?  If so, then this formula can be used in place of the one you have:

DropColumns(
    SortByColumns(
        AddColumns(
            Filter('Holiday Party Prizes', Status="Available" && Party.Value=ddPartyChoice.Selected.Value),
            "prizeTitle", Match(Title, "[^$\d+]\D+").FullMatch
        ),
        "prizeTitle",
        Ascending
    ),
    "prizeTitle"
)

 

This uses a regular expression to get the text part of the Title and then it sorts by it.

Note, the added column is dropped because it is no longer needed.

 

I hope this is helpful for you. 🙂

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

3 REPLIES 3
RandyHayes
Super User
Super User

@tagustin2020 

Hi again! 

Sure thing...do all the prizes start with a dollar value?  If so, then this formula can be used in place of the one you have:

DropColumns(
    SortByColumns(
        AddColumns(
            Filter('Holiday Party Prizes', Status="Available" && Party.Value=ddPartyChoice.Selected.Value),
            "prizeTitle", Match(Title, "[^$\d+]\D+").FullMatch
        ),
        "prizeTitle",
        Ascending
    ),
    "prizeTitle"
)

 

This uses a regular expression to get the text part of the Title and then it sorts by it.

Note, the added column is dropped because it is no longer needed.

 

I hope this is helpful for you. 🙂

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes 

 

Randy, you are very clever. Being a novice, I never would have figured this out on my own. Yes, all of the prizes start with a dollar amount. The formula you provided is working perfectly. Thank you very much! Teresa

 

SortOrderSolved.png

 

RandyHayes
Super User
Super User

@tagustin2020 

No problem!  That's why you have a community to reach out to for help 😁

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Solution Authors
Top Kudoed Authors
Users online (2,430)