web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Sort Gallery by Color ...
Power Apps
Answered

Sort Gallery by Color of Text

(0) ShareShare
ReportReport
Posted on by 30

I have a gallery of records that track hours.  The color of text in 3 Text Input Boxes changes based on a preset calculation (i.e. current hours +40).  They turn Red to alert that action needs taken.

 

I want to sort Gallery items by records with text that is red.   (I have 3 fields in each record that can turn Red)

 

Any suggestions on best way to sort records this way?  I don't see a way to sort by text color of a specific field.  I've been thinking I could set a variable (High priority, Low Priority, then sort the gallery by that) that changes when the color of the text changes, but haven't been able to identify what syntax/formula to use in what field to create the variable.

Categories:
I have the same question (0)
  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @Spaderk,

    Do you want to sort by some special items in your Gallery?

    Could you please tell me that how you configure the relationship between priority and color?

     

    Actually, we could customize the sort order by a customized table. For example, you can sort record based on the name of a day of the week by supplying [ "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ] as the sort order. All records which have Monday" will come first, followed by Tuesday, and so on.

    SortByColumns( Data, "WeekDay", [ "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ] )

     

    You could add a temporary column to assign different priority for different text color, like red color for High priority and other color for low priority, so we could sort gallery items by:

    SortByColumns( Data, "Priority", [ "High Priority", "Low Priority" ] )​
  • Spaderk Profile Picture
    30 on at

    Gallery is currently sorted by Field Title (#FB3, #FB2, #E801)

    Spaderk_0-1677255057986.png

    Here's an example of the record set at 0. 

     

    When Current Hours Text Input Box gets updated to "40"

    Grease Due: "40" TURNS RED

     

    When Current Hours Text Input Box gets updated to "400"

    Oil Change Due "400" TURNS RED

     

    When Current Hours Text Input Box gets updated to "8760"

    Brakes Due "8760" TURNS RED

     

    I'd like to be able to sort the Gallery so that items with the red numbers are showing first.  I don't currently have them set with a priority.  I've thought about doing that as a variable, but haven't done that.  Hope that helps.

     

  • Spaderk Profile Picture
    30 on at

    I don't have a priority set, I was thinking I could if that would help, but I haven't figured out how to set it to change as the text color would change.  How would you set a variable in that case?  Currently the text box "Color" field has this formula in it: 

    If(
    (Value(ThisItem.'Current Hours')>=Value(ThisItem.'Greasing Due'-5)),Color.Red,Color.Black)

     

    I'm not sure where to add the variable to make it High or low, that was just an idea I thought I could make work.

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @Spaderk

    Sorry for the late reply.

    I think I have got you. You just want to make the records with the red font color display front,right?

     

    To achieve this, maybe we could try something different, we could mark the records that has red font color, and sort the mark.

    vqiaqimsft_0-1677725911522.png

  • Spaderk Profile Picture
    30 on at

    Thank you, I'll try that.  I've never used "Mark"

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 505

#2
WarrenBelz Profile Picture

WarrenBelz 502 Most Valuable Professional

#3
Haque Profile Picture

Haque 324

Last 30 days Overall leaderboard