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

Conditional IF() in HTMLtext for Font Color

Hi,

 

I have a scanning app, and at the end, it sends out a HTML to the email. 

 

The HTML has a table, and I want to make a conditional statement in couple of the columns.

 

I have Item code, Lot #, and Expiry Date as the column headers.

Whenever, the Expiry Date is equal or less than todays date for that product, that rows Lot # and Expiry Date should be changed to a red font instead of black.  

 

Currently, I have this: 

 

<td>"&If(DateValue(Text(Value(EXPIRY),"[$-en-US]20##-##-##"))<=Today(),EXPIRY && Red , EXPIRY && Black )&" </td> 

 

But gives me the Invalid Argument error, and it makes sense as Red and Black are Color. 

 

Is there a way to do this? 

 

 

* The table headers and rows are connected with Concat function. 

 

1 ACCEPTED SOLUTION

Accepted Solutions
mdevaney
Super User
Super User

@Anonymous 

I think the issue is you need to change the font color via HTML rather than using the PowerApps language.

 

<td><font color="""&
If(DateValue(Text(Value(EXPIRY),"[$-en-US]20##-##-##"))<=Today(),"Red", "Black")&"""> EXPIRY </font></td>"

 

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

View solution in original post

2 REPLIES 2
mdevaney
Super User
Super User

@Anonymous 

I think the issue is you need to change the font color via HTML rather than using the PowerApps language.

 

<td><font color="""&
If(DateValue(Text(Value(EXPIRY),"[$-en-US]20##-##-##"))<=Today(),"Red", "Black")&"""> EXPIRY </font></td>"

 

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

You're right. 

I was able to fix it using your framework. 

 

Thank you

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 (5,161)