Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Change Text Color based on another column

Posted on by

Hello,

 

I'm trying to change the text color of a label based on the status on another column but it is not working. So i have a Employee column and another column with status. I want text color for Employee column to be Red if the status column= Vacant, anything else is just black. 

 

I tried this but its not working and it looks like im missing some information.

If(ThisItem.Status.Value ="Vacant",Color.Red,Black)

 

 

 

Categories:
  • Anand_A Profile Picture
    Anand_A 33 on at
    Re: Change Text Color based on another column

    Are you applying this “If(ThisItem.Status.Value ="Vacant",Color.Red,Black)” in gallery? Any screenshot?

  • subsguts Profile Picture
    subsguts 1,259 on at
    Re: Change Text Color based on another column

    Great!!!  If you can mark what I put below as the answer, that would be great and a kudo 🙂  Always appreciated 🙂

  • subsguts Profile Picture
    subsguts 1,259 on at
    Re: Change Text Color based on another column

    Yes, that will matter because you'll want to change the color on the item that is selected in the gallery.  I can't get the formula exactly right as I'm heading out the door.  but something like gallery.selecteditem.color needs to be set instead of the color property.  Again, I can look into this more when I return.

     

  • Verified answer
    punksterz626 Profile Picture
    punksterz626 on at
    Re: Change Text Color based on another column

    actually it works now if i input it as follow "If(ThisItem.Status ="Vacant", Color.Red,Color.Black) whereas before i just typed the Red and Black as is. 

  • punksterz626 Profile Picture
    punksterz626 on at
    Re: Change Text Color based on another column

    still doesnt work. I'm not sure if it matters but the thisitem.Employee label is inside a gallery. 

  • subsguts Profile Picture
    subsguts 1,259 on at
    Re: Change Text Color based on another column

    And you still get the same error?  Or it just doesn't work still?  I'm stepping away for a few hours, but will be happy to help when I return.  This should work as my example below uses a text field and a label too and works.

     

  • punksterz626 Profile Picture
    punksterz626 on at
    Re: Change Text Color based on another column

    I excluded that. The syntax If(ThisItem.Status ="Vacant",Red,Black) 

  • subsguts Profile Picture
    subsguts 1,259 on at
    Re: Change Text Color based on another column

    Get rid of the ".Value"

  • punksterz626 Profile Picture
    punksterz626 on at
    Re: Change Text Color based on another column

    single line text

  • subsguts Profile Picture
    subsguts 1,259 on at
    Re: Change Text Color based on another column

    What type of field is the Status? (combo box?)

     

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,246

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,884

Leaderboard