Value Template format

#1

Hi,

Is there documentation on the value templates? The example for the weather API uses the top level nodes in the result, but I’m unable to see how to access the deeper information stored in minutely, hourly, etc within the array?

Basically, adding something like {{result.body.minutely.data]] doesn’t work

0 Likes

#2

That should work unless there is an array in the path. When referencing arrays you need to use .index notation. So would be something like {{ data.body.0.name }} where body is an array of objects. You can read more about templates over at the docs, https://docs.losant.com/workflows/accessing-payload-data/#string-templates.

Also, make sure you’re using curly brackets on both ends. I assume that the square brackets above in your question are just a typo though.

0 Likes

#3

That was very helpful - the ]] was indeed a typo.

I still have a challenge displaying the array in a tabular dashboard. How does one iterate through and show all rows in the dashboard?

e.g

{
  "data" : {
    "name" : "Bruce Campbell",
    "age" : 57,
    "movies" : [
      {
        "title" : "Army of Darkness",
        "year" : "1992"
      },
      {
        "title" : "Evil Dead II",
        "year" : "1987"
      },
      {
        "title" : "The Evil Dead",
        "year" : "1981"
      }
    ]
  }
}

Display this in a tabular dashboard, one row per entry in array.

0 Likes

#4

The dashboards are designed around time series data. For example the weather station stores a snapshot every two minutes. The same attributes (temp, humidity, etc) are reported over and over again with new values. Our dashboard blocks then provide ways to graph and aggregate these values over time.

The movie data, as-is, isn’t time series data so it can’t be directly displayed.

Dashboards also display information reported by devices, they don’t visualize raw data. In order to be displayed on a dashboard the data must first be reported by a device. The weather station example pulls raw data from an API and reports it into a virtual device. We can then visualize data stored in that device.

0 Likes