cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

If statment label contains text "YES" just make the text "YES" red

Hi Guys,

 

im trying to make some text (just the word YES) within a label appear red using the following,

 

If(Contains("YES",Label9_2.Text)),Red,RGBA(0, 0, 0, 0))

 

the label contains a few fields that i have concatenated together? is it my code or the because of the concatenate function before the if statement? 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Anonymous ,

Based on the issue that you mentioned, I think the Html text control and the Substitute function could achieve your needs.

 

I have made a test on my side, please consider take a try with the following workaround:

7.JPG

Set the HtmlText property of the Html Text control to following:

Substitute("Show your Yes or No value", "Yes", "<b style='color:red;'>Yes</b>")

On your side, you should set the HtmlText property of the Html Text control to following:

Substitute(
           Concatenate(...),       // Type your Concatenate(...) formula here
           "Yes", 
           "<b style='color:red;'>Yes</b>"
)

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
mdevaney
Community Champion
Community Champion

@Anonymous 

I am not aware of the function CONTAINS but you can use the IN operator to achieve your goal.

 

If("YES" in Label9_2.Text, Red, RGBA(0, 0, 0, 0))

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

Anonymous
Not applicable


@mdevaney wrote:

@Anonymous 

I am not aware of the function CONTAINS but you can use the IN operator to achieve your goal.

 

 

If("YES" in Label9_2.Text, Red, RGBA(0, 0, 0, 0))

 

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 


I get an error on the 

 

; 

 

after the concatenate and before the

 

If("Defect" in Label9_2.Text, Red, RGBA(0, 0, 0, 0))  

 

ive also tried the others & and &&..

@Anonymous 

I don't see any symbol or concatenation in the code you have provided.  Please show a screenshot of the highlighted code with the error message showing.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Anonymous
Not applicable


@mdevaney wrote:

@Anonymous 

I don't see any symbol or concatenation in the code you have provided.  Please show a screenshot of the highlighted code with the error message showing.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."


asdasdasd.png

 

Ignore the redacted its just different text column data. (it works great) just cant combine the syntax

@Anonymous 

You can only control the text color using the color property.  If you put this code in the Text property it would either highlight the entire text red if Defect is found or transparent if not found.

If("Defect" in Label9_2.Text, Red, RGBA(0, 0, 0, 0))  

 

HTML text can be used to highlight only a portion of a text-string but I have no idea how to detect where the position of YES is.  Is it always in the same position?

Text before <font color="red"> YES </font> Text after

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Anonymous
Not applicable


@mdevaney wrote:

@Anonymous 

You can only control the text color using the color property.  If you put this code in the Text property it would either highlight the entire text red if Defect is found or transparent if not found.

 

If("Defect" in Label9_2.Text, Red, RGBA(0, 0, 0, 0))  

 

 

HTML text can be used to highlight only a portion of a text-string but I have no idea how to detect where the position of YES is.  Is it always in the same position?

 

Text before <font color="red"> YES </font> Text after

 

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."


Yes. The information from the column is "brought" in by a flow, if the conditions are met to send the flow the words "YES" are at the end of Description 3 below, (there is a generic sentence before YES)

 

 

"
"&'Description1'&"
"&'Description2'&"
"&'Description3'&"
"

 

 

Hi @Anonymous ,

Based on the issue that you mentioned, I think the Html text control and the Substitute function could achieve your needs.

 

I have made a test on my side, please consider take a try with the following workaround:

7.JPG

Set the HtmlText property of the Html Text control to following:

Substitute("Show your Yes or No value", "Yes", "<b style='color:red;'>Yes</b>")

On your side, you should set the HtmlText property of the Html Text control to following:

Substitute(
           Concatenate(...),       // Type your Concatenate(...) formula here
           "Yes", 
           "<b style='color:red;'>Yes</b>"
)

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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