0

HTML and Ninox

So I'm trying to understand the difference between using double quotes ( " ) and --- when creating HTML code.

I have the following code:

let tbleHead := "
    <thead class='tableFixHead'>
        <tr>
            <th>Name</td>
            <th>" +
    if League = 2 then "R1Atm" else "Atm" end +
    "</th>
                " +
    if League != 2 then "<th>AvP</th>" end +
    "
        </tr>
    </thead>";

This creates the third table header properly.

But if I use the three dashes:

let tbleHead2 := ---
        <thead>
        <tr>
        <th>Name</th>
        <th>Atm</th>{ if League != 2 then "<th>AvP</th>"  end }
        </tr>
        </thead>
    ---;

I get undefined.

 I can't figure out to escape back to Ninox when using three dashes.

Thanks,

6 replies

null
    • Fred
    • 2 wk ago
    • Reported - view

    So when you use three dashes you can access field names by using curly brackets: { }. But these don't work if you want to escape out to Ninox to run commands.

    • red_kite
    • 2 wk ago
    • Reported - view

    Try this, but i do not know if that is this, what you need. Mirko

    let tbleHead2 := ---
        <thead>
            <tr><th>Name</th>{ if lastPr != 2 then "<th>Atm</th><th>AvP</th>"  else "<th>R1</th><th>Atm</th>"  end }</tr>
        </thead>
        ---;
    html(tbleHead2)
    
      • red_kite
      • 2 wk ago
      • Reported - view

      In my script is "lastPr" your "League" ;-). I use my template tables in everyday life. Hope it helps you. Mirko

      • Fred
      • 2 wk ago
      • Reported - view

      Thanks for the tip. I actually want the first two th to show (Name and Atm). The third th (AvP) should only show if lastPr != 2. It seems like the coding should work according to your sample, but it just gives me an error.

    • red_kite
    • 2 wk ago
    • Reported - view

    Hi Fred. Sorry if I should mistranslate some things. The sequence for the table header can also be swapped to a variable. This makes it a little clearer again.

    let head := if League != 2 then
            "<th>Name</th><th>Atm</th><th>AvR</th>"
        else
            "<th>Name</th><th>Atm</th>"
        end;
    let tbleHead2 := ---
        <thead>
            <tr>{ head }</tr>
        </thead>
        ---;
    html(tbleHead2)
    
      • Fred
      • 2 wk ago
      • Reported - view

      That works. Thanks.