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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Multiple Conditional s...
Power Apps
Unanswered

Multiple Conditional statements to change color for Thisitem.value

(0) ShareShare
ReportReport
Posted on by 30

Hi Everyone,

 

I have been trying to add conditional statements to a field in gallery mood to faciliate the view to understand a process that is still pending. I followed the steps from a previous questions. Re: Multiple conditional statements to change color of text based on another columns value not worki 

 

 

However, when I tried type it out under ThisItem field I get various errors. 

 

This is the formula i used in the field for text: 

 

If(ThisItem.'Email to Stat Sent?'.Value="No", RedThisItem.'Email to Stat Sent?'.Value="Yes", Green )

 

Can someone help me out.... 

 

Thanks

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    on at

    Hi @DanMuriel ,

     

    I tried this for multi conditional statements in the Color property or certain items displayed for the Gallery and this appeared to work okay, the code depends on the underlying field.

     

    If this is a plain text field I used the following:

     If(ThisItem.'Email to Stat Sent?'="Yes",Red,ThisItem.'Email to Stat Sent?'="No",Green)

     

    If you want to display Yellow for entries that do not have Yes or No, then 

    If(ThisItem.'Email to Stat Sent?'="Yes",Red,ThisItem.'Email to Stat Sent?'="No",Green,Yellow)

     

    However, if the underlying field was a checkbox, this was changed to 

    If(ThisItem.'Email to Stat Sent?'.Value="Yes",Red,ThisItem.'Email to Stat Sent?'.Value="No",Green)

     

    Or the following to change to Yellow if Yes or No is not entered.

    If(ThisItem.'Email to Stat Sent 2?'.Value="Yes",Red,ThisItem.'Email to Stat Sent 2?'.Value="No",Green,Yellow)

     

    Hope this helps

  • RusselThomas Profile Picture
    4,014 on at

    @DanMuriel,

     

    Aside from the mental flinching seeing question marks in control names (yikes Smiley LOL), the formula you pasted does have one syntactical error;

     

    If(ThisItem.'Email to Stat Sent?'.Value="No", RedThisItem.'Email to Stat Sent?'.Value="Yes", Green )

    you would be missing a comma between Red and ThisItem

     

     

    If(
     ThisItem.'Email to Stat Sent?'.Value="No", Red,
     ThisItem.'Email to Stat Sent?'.Value="Yes", Green
    )

    If it's just a typo in your post, then it might be something else.

     

    Kind regards,


    RT

     

  • DanMuriel Profile Picture
    30 on at

    @RusselThomasYes the coma was missing but that was not the error. The error message that I have always get is 

     

    The property expects Text values, but this rule produces incompatible Color values.

     

    This is what is in the text field: 

     

    If(
    ThisItem.'Email to Stat Sent?'.Value="No", Red,
    ThisItem.'Email to Stat Sent?'.Value="Yes", Green
    )

     

    image.png

     

  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @DanMuriel 

    You need to put these formulas suggested on the Color property, not on the Text property.

    Assuming that you wanted to change the text color in all of this.  If it's the background you are trying to change, then, for an individual control, put these formulas in the Fill property.  If it's an entire Gallery row you're trying to fill, then set the TemplateFill property of the Gallery to the formulas given.

     

    Hope that helps.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard