cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TimoMigchielsen
Post Prodigy
Post Prodigy

If statement in HTML Text

Hello there!

I am having some HTML code to export information from a gallery. I want the background to be changed green or red depending on whether is true or false. The whole thing works but we just need to have a condition and change the background of the information in the columns. How can I do this? I think it's either th or td that we have to change

Here is my code;

"<html>
<head>   
    <style>
    table {
        width: 100%;
        border-collapse: collapse;
        text-align: center;
    }

    th, td {
        text-align: center;
        border: 1px solid black;
        font-size: 12px;
    }

    h1{
        color:#325ca8;
        }

    tr:nth-child(even){background-color: #f2f2f2}

    th {
        background-color: #325ca8;
        color: white;
    }

    </style>
    </head>
    <body>
    <H1>Project " & DropdownOrder.SelectedText.Result & "-" & DropdownDeelorder.Selected.Result & "</H1>
    <Table>
    <tr><th>Verdieping</th>
    <th>UniekNummer</th>
    <th>Geopperd</th>
    <th>GeopperdDatum</th>
    <th>Gemonteerd</th>
    <th>GemonteerdDatum</th>
    <th>Opgeleverd</th>
    <th>OpgeleverdDatum</th>
    <th>Aantal</th></tr>
    " & Concat(
    Gallery3.AllItems;
    "<tr><td>" & Verdieping &  "</td><td>"
    & UniekNummer & "</td><td>"
    & Geopperd & "</td><td>" 
    & GeopperdDatum & "</td><td>" 
    & Gemonteerd & "</td><td>" 
    & GemonteerdDatum & "</td><td>" 
    & Opgeleverd2 & "</td><td>" 
    & OpgeleverdDatum & "</td><td>"
    & Aantal & "</td></tr>"
) & "
</table>
</body>
</html>
"

 

2 REPLIES 2
gabibalaban
Super User
Super User

Hi @TimoMigchielsen ,

Definitively the <td>.

Here is some hints:

ForAll(
        Gallery3.AllItems,
        With(
            {border: If(condition,"green","red")},
            "<td style='background-color:" & border & "'>" & ColumnName & "</td>"
        )
    ),
    Value
) 

 

How would I implement that into the HTML I have right now? I can't seem to get it working

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Users online (3,112)