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

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (78,558)