cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
shaneOZ Responsive Resident
Responsive Resident

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
Community Support
Community Support

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

Hi @shaneOZ ,

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

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

@shaneOZ 

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." 

shaneOZ Responsive Resident
Responsive Resident

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


@mdevaney wrote:

@shaneOZ 

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 &&..

Super User
Super User

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

@shaneOZ 

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."

shaneOZ Responsive Resident
Responsive Resident

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


@mdevaney wrote:

@shaneOZ 

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

Super User
Super User

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

@shaneOZ 

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."

shaneOZ Responsive Resident
Responsive Resident

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


@mdevaney wrote:

@shaneOZ 

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'&"
"

 

 

Community Support
Community Support

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

Hi @shaneOZ ,

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

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

‘Better Together’ T-Shirt Contest – Winner Announced!

‘Better Together’ T-Shirt Contest – Winner Announced!

And the winner is...

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Power Platform 2020 release wave 1 plan

Power Platform 2020 release wave 1 plan

Features releasing from April 2020 through September 2020

Top Solution Authors
Top Kudoed Authors
Users online (7,723)