Modifying items and rows on 2.0 tables


I tried to follow the template script tutorial, where you could specify an item and then tell it to be Celcius or to change the background color. I'm guessing that the issue is my item names.

In one table they are like this:

data = [
        "Sijainti": "Yläkerran vuokratila",
        "Tila": ylakerta.tila,
        "Lämpötila": ylakerta.temp,
        "kosteus": ylakerta.rh,
        "aikaleima": ylakerta.time,
        "Paristo": ylakerta.batt
        "Sijainti": "Kellari",
        "Tila": kellari.tila,
        "Lämpötila": kellari.temp,
        "kosteus": kellari.rh,
        "aikaleima": kellari.time,
        "Paristo": kellari.batt

Lämpötila = temperature . On the second table the data is like this:

data = [
        "Piiri": "Patterikierto",
        "tila": POL368.HMI1tila,
        [POL368.HMI03100Read[1][15]]: POL368.HMI03100Read[0][15],
        [POL368.HMI03100Read[1][10]]: POL368.HMI03100Read[0][10],
        [POL368.HMI03100Read[1][20]]: POL368.HMI03100Read[0][20],
        [POL368.HMI03100Read[1][21]]: POL368.HMI03100Read[0][21]
        "Piiri": "Puhallinkierto",
        "tila": POL368.HMI2tila,
        [POL368.HMI03200Read[1][15]]: POL368.HMI03200Read[0][15],
        [POL368.HMI03200Read[1][10]]: POL368.HMI03200Read[0][10],
        [POL368.HMI03200Read[1][20]]: POL368.HMI03200Read[0][20],
        [POL368.HMI03200Read[1][21]]: POL368.HMI03200Read[0][21]
        "Piiri": "Käyttövesi",
        "tila": POL368.HMI3tila,
        [POL368.HMI03200Read[1][15]]: POL368.HMI04100Read[0][6],
        [POL368.HMI03200Read[1][10]]: POL368.HMI04100Read[0][7],
        [POL368.HMI03200Read[1][20]]: POL368.HMI04100Read[0][9],
        [POL368.HMI03200Read[1][21]]: POL368.HMI04100Read[0][10]

Here the name is taken from an array. Again, how would I reference that item or a row?

Hi @ektoekto, welcome to the forum.

Which template script tutorial is that? (link?)

What is your issue? Getting an error? Null values? Undefined values?

What name?

Which item, which row?

Show us your data (debug message) explain what you need to put where.

Additionally, you say "template" however you are assigning an array to something called data - templates are NOT javascript and cannot do assignment. Is tis actually a function node?

More details and more context please.

Sorry for my poor explanation. Here's the example:

 <template"{ item }">
        <!-- Add a custom suffix to the value for the "target" column -->
        {{ }}°C

Here you can see that he uses "" to add a °C column named target. I tried to do the same by adding a template-element before my table, but nothing happens and I don't get any errors. I was thinking that my issue could be that the column name is "Lämpötila" and that could be the issue? Although I did try to change the column name for something simpler.

How are you supposed to add the celcius thing to the value?

And how would you change the bc color of an item or a row depending of the value of item?

I got it :neutral_face:

The example is an table of it self, I don't need the UI table element. The whole thing lives inside the template.

This can definitively be roved.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.