web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : vI3klFqa06a/+5wnpyQYJC
Power Apps - Building Power Apps
Answered

html cell background-color

Like (0) ShareShare
ReportReport
Posted on 23 May 2022 08:32:36 by 402

Hi there,

 

i have a collection, and i want to send a email in an html format.

i want furthermore display cell's color depending on the status value.

i mess to achieve that last point, and i don't know if it's possible in Powerapps or if i have to do it in power automate

 

The basic html code is the following

<td style=""background-color:red;"">" & Statut & " </td>

 

i tried something like that, but without succes

If(Ldlv_Rapport.Statut in "HS";
 <td style=""background-color:red;"">" & Statut & " </td>);
 Ldlv_Rapport.Statut in "HS après intervention";
 <td style=""background-color:Orange;"">" & Statut & " </td>);
 white)

i want to have something like that

 

GeekAlf_Pro_0-1653294725591.png

 

Thanks

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    151,827 Most Valuable Professional on 23 May 2022 at 08:43:02
    Re: html cell background-color

    Hi @GeekAlf_Pro ,

    Following the logic you posted, try this

    "<td bgcolor =" & 
    If(
     Ldlv_Rapport.Statut in "HS";
     "#FF0000";
     Ldlv_Rapport.Statut in "HS après intervention";
     "#FFA500";
     "#FFFFFF"
    ) & ">" & Statut & " </td>"

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • GeekAlf_Pro Profile Picture
    402 on 23 May 2022 at 08:55:41
    Re: html cell background-color

    Hello @WarrenBelz 

     

    thanks for taking time to answer.

    unfortunatly, i have this message

    GeekAlf_Pro_0-1653296047293.png

    it says  "impossible to use Table in this context"

     

  • WarrenBelz Profile Picture
    151,827 Most Valuable Professional on 23 May 2022 at 10:42:30
    Re: html cell background-color

    @GeekAlf_Pro ,

    I cannot test this presently, but what happens when you do this

    "<td bgcolor = #FF0000">" & Statut & "</td>)"
  • GeekAlf_Pro Profile Picture
    402 on 23 May 2022 at 10:47:20
    Re: html cell background-color

    with your code slightly modified, all the column is red

     

    <td bgcolor = #FF0000>" & Statut & "</td>

     

  • GeekAlf_Pro Profile Picture
    402 on 23 May 2022 at 10:50:07
    Re: html cell background-color

    i think that it is not the code with the color that's the problem

    but the fact that i can't use the value of the status, hence the message "impossible to use a table in this context"

  • Verified answer
    WarrenBelz Profile Picture
    151,827 Most Valuable Professional on 23 May 2022 at 10:57:50
    Re: html cell background-color

    @GeekAlf_Pro ,

    Then the other code should work and display the different colours. Try this, but it is really the same

    With(
     {
     wColour:
     If(
     Ldlv_Rapport.Statut in "HS";
     "#FF0000";
     Ldlv_Rapport.Statut in "HS après intervention";
     "#FFA500";
     "#FFFFFF"
     )
     };
     "<td bgcolor =" & wColour & ">" & Statut & " </td>"
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • GeekAlf_Pro Profile Picture
    402 on 23 May 2022 at 11:35:56
    Re: html cell background-color

    Thanks a lot @WarrenBelz 

     

    the "with" helps me a lot and i replaced the "ldlv_rapport.statut" by "ThisRecord.statut" and it works fine !

     

    here is the final code

    "& With(
     {
     wColour:
     If(
     ThisRecord.Statut in "HS";
     "#FF0000";
     ThisRecord.Statut in "OK après intervention";
     "#FFA500";
     ThisRecord.Statut in "OK";
     "#b0f2b6";
     "#FFFFFF"
     )
     };
     "<td bgcolor =" & wColour & ">" & Statut & " </td>"
    )&"

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 714 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 419 Super User 2025 Season 2

#3
developerAJ Profile Picture

developerAJ 243

Last 30 days Overall leaderboard
Loading complete