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 Apps
Answered

Two separate If's

(0) ShareShare
ReportReport
Posted on by 225

Good afternoon

 

I have two separate If statements that need to go under the Color property of a text input.

 

If(Len(dtacrdContainer_CAE.Text) = 11, RGBA(0, 18, 107, 1), Color.Red)
If(LookUp(glContainers, ContainerId = Upper(Self.Text), true), Color.Black, Color.Red)

 

All I need to do is 'join' them together so that they don't error.  As you can see, they both do different things.  Every syntax I've tried writing gives me an error.  I know it's going to be simple but I don't know how to do it. 

Categories:
  • Ash13 Profile Picture
    576 on at

    Hi @Automate2create 

    The If function works like:

    If(Condition, Result, Condition, Result, Condition, Result, ......., Else Result)

    So yours would be:

    If(Len(dtacrdContainer_CAE.Text) = 11, RGBA(0, 18, 107, 1),
    LookUp(glContainers, ContainerId = Upper(Self.Text), true), Color.Black,
    Color.Red)

     

  • Verified answer
    mmollet Profile Picture
    3,187 on at

    First thing I noticed was that the LookUp in your second if statement will always result in true and make the color black. This is because you are returning true from the LookUp regardless of what it does/doesn't find. If you want to make it black if there is an item and red if it finds nothing for example try the following:

    If(IsBlank(LookUp(glContainers, ContainerId = Upper(Self.Text))), Color.Red, Color.Black) -> no item found is red

    The second thing I noticed is that both of your statements result in Red in the case everything is false which makes it easier to work with. 

    the next thing you have to decide is which of these is more important if it is true. So if both resulted in true do you want black or RBGA(0,18,107,1)? Whichever you choose will need to be placed first that way if it is true it gets evaluated first. 

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 409 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 252 Most Valuable Professional

Last 30 days Overall leaderboard