cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Channah
Helper III
Helper III

attempting to use fill function to change based on text value

Hi there, 

 

I have a gallery with a number of labels. 

 

I would like the fill colour of these labels to change colour based on the text the label has. 

 

e.g. 

a strip down version of what I am trying to do

label has an option to be yes or no 

I would like yes  = green, no = red. 

 

attempted below with no success

If(Text(label1.Text) = Yes, Green))

 

Thanks

3 ACCEPTED SOLUTIONS

Accepted Solutions
eka24
Super User
Super User

Try on the fill or color property of the label

If(label1.Text = "Yes", Green,Red)

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

Hi @Channah 

For the gallery, I would do it based on the value of the column and not the label itself. Try this: If(ThisItem.ColumnName = "Yes", Green, Red)

Regards,

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

View solution in original post

Hi @Channah 

You can do it this way 

If(
   ThisItem.ColumnName = "Yes", Green,
   ThisItem.ColumnName = "No", Red,
   ThisItem.ColumnName = "Pending", Yellow
)
Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

View solution in original post

5 REPLIES 5
eka24
Super User
Super User

Try on the fill or color property of the label

If(label1.Text = "Yes", Green,Red)

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Thank You!!

Hi @Channah 

For the gallery, I would do it based on the value of the column and not the label itself. Try this: If(ThisItem.ColumnName = "Yes", Green, Red)

Regards,

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Sorry,

 

If I had more than two options. 

 

YES: GREEN

NO: RED

PENDING: YELLOW

How would I include this additional step? 

 

thanks

Hi @Channah 

You can do it this way 

If(
   ThisItem.ColumnName = "Yes", Green,
   ThisItem.ColumnName = "No", Red,
   ThisItem.ColumnName = "Pending", Yellow
)
Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Check out the New Ideas Site

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (3,940)