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
Super User
Super User

@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
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,328)