Skip to main content
Community site session details

Community site session details

Session Id : fgO9MWCZ0F2Vse4VmBBe2R
Power Apps - Building Power Apps
Answered

Sort Gallery by Color of Text

Like (0) ShareShare
ReportReport
Posted on 23 Feb 2023 23:31:57 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:
  • Spaderk Profile Picture
    30 on 02 Mar 2023 at 20:36:27
    Re: Sort Gallery by Color of Text

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

     

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    on 02 Mar 2023 at 02:59:37
    Re: Sort Gallery by Color of Text

    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 01 Mar 2023 at 17:06:41
    Re: Sort Gallery by Color of Text

    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.

  • Spaderk Profile Picture
    30 on 24 Feb 2023 at 16:19:11
    Re: Sort Gallery by Color of Text

    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.

     

  • v-qiaqi@microsoft.com Profile Picture
    on 24 Feb 2023 at 06:15:39
    Re: Sort Gallery by Color of Text

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

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Loading complete