I have a Powerapp that is connected to a SharePoint List, I'm trying to change the color of a gallery icon based on three things:
1) if the status is Yes -P, Yes -M, or Yes -J then show the checkbadge icon in green
2) if the status is No then show the cancelbadge in red
3) If Date 2 is empty but the status is Yes -P, Yes -M, or Yes -J show the checkbadge icon in yellow
I have tried to use many different if's over the last few days. I have it working to show the First two items with the switch, but the third item is where I'm having difficulties. Below is what I have for code on the color of the icon badge:
Switch(ThisItem.'Status'.Value,
"Yes - P", Color.Green,
"Yes - M",Color.Green,
"Yes - J",Color.Green,
Color.Red)
Any help would be greatly appreciated.
Your Formula would not have worked because you were testing to see if the Logical Boolean OR of Date2 and Date3 was blank. This would never be because Date2 and Date3 are dates or empty, not Boolean true or false.
What you want to OR together is the true or false result of IsBlank against a single date/column.
So, IsBlank(Date2 || Date3) will cause the evaluation to logically OR the two dates together and then IsBlank would look at the result of that OR to see if it is blank...which it would not be. It would really not be valid, but if anything it would always be false - date or no date. So, IsBlank would always return false because a Boolean true or false is not blank.
hopefully that is clear and helpful.
Great, thank you again. Would you be able to explain the difference? So I have a better understanding on why my code wouldn't of worked?
Actually you would need to specify two functions for that.
The formula would be:
If(StartsWith(ThisItem.Status.Value, "No"), Red,
IsBlank(Date2) || IsBlank(Date3), Yellow,
Green
)
Just for my records, (because I think I can see needing to do this with another date field) what would the If statement look like for that, would the below work?
If(StartsWith(ThisItem.Status.Value, "No"), Red,
IsBlank(Date2 || Date 3), Yellow,
Green
)
Thanks for the help, I'm just staring out trying Powerapps.
That did it, Thank you very much!
If that is the case, you can just check if it starts with No.
Ex:
If(StartsWith(ThisItem.Status.Value, "No"), Red,
IsBlank(Date2), Yellow,
Green
)
Thank you for this, I have one more question. If I have multiple No's/None to show as red in item 2 from above how would I modify this to work? For example
No - M, No - R, None as the options?
Please consider changing your Formula to the following:
If(ThisItem.Status.Value = "No", Red,
IsBlank(Date2), Yellow,
Green
)
Since you seem to indicate that the Value will either be Yes (with more info) or No, then first check for No...you have one condition for that - Red.
Otherwise, you know now that it is not No, so check the Date. If it is blank, then Yellow. Everything else evaluates to Green.
I hope this is helpful for you.
MS.Ragavendar
20
BCBuizer
10
Super User 2025 Season 1
LC-26081402-0
10