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

HTML - dynamic HTML formatting using CONCAT and <font color>

Situation: I have a collection that has two columns: a question and an answer field.

 

Desire: To generate an HTML PowerApp insert that grabs the questions and answers into a table. I've been able to do that successfully, but I want to add some conditional formatting. For example, if my answer is "1," I want the text to be red, if the answer is 2, I want the text to be green.

 

See below for my start: The issue with my coding below is that it's a table - so I don't know if I need to use First...or ThisItem...any help would be much appreciated!

 

"<!DOCTYPE html>
<html>
<body>
<Table width='100%' border='1' cellpadding='5' style='border:0px solid black; border-collapse:collapse'>" &
     "<tr style='background-color:#efefef'>
 <td align='left'><b>Question</b></td>
  <td align='left'><b>Answer<b></td>
  </tr>"
  & Concat(colanswers, "<tr><td>" & Question & "</td><td><font color="""&If(colanswers.Answer="1","Blue","Red")&""">" & Answers & "</font></td></tr>")

&
"
</table>"&"
</body>
</HTML>
"
1 ACCEPTED SOLUTION

Accepted Solutions
mdevaney
Super User III
Super User III

@Specoop 

The column name should be supplied without ThisItem or colAnswers in front of it.  There is no need to disambiguate since CONCAT knows the datasource from the 1st argument.

 

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

@Specoop 

The column name should be supplied without ThisItem or colAnswers in front of it.  There is no need to disambiguate since CONCAT knows the datasource from the 1st argument.

 

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

Worked like a charm! Thank you!

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,373)