Nested Array's in dataset

Hej,

We are experimenting if XIBO is the right way to go for our digital signage needs. One of the things we are trying is using the API of the program we use for day to day use.

We have succeeded in creating a dataset, and displaying certain columns in a layout.

But we would like to expand on this. We want to display all events of a certain day that we organise (multiple events in multiple rooms) in the entrance hall of our venue.
We can generate a json file which hold this information but we are having difficulty in putting this into columns.

An event can have multiple instances of a schedule, therefore the json has this data nested. We have not found a way to get this info in columns.

Another question we have is that we have tried using:
Dependant fields: {{COL.NAME}} where NAME is a FieldName from the dependant DataSet
but we are having trouble understanding how to use this. We succeeded in using the {{DATE}}, but we are unsure about what value we need to use for “COL”.

An example of the json file we generate (we adjusted values for security):
{
“entries”: [
{
“pagination”: {},
“data”: [
{
“location”: {
“url”: “https://”,
“id”: “1”,
“name”: “Room 1”,
“_type”: “location”
},
“schedules”: []
},
{
“location”: {
“url”: “https://”,
“id”: “2”,
“name”: “Room 2”,
“_type”: “location”
},
“schedules”: [
{
“scheduletype”: “resourcebooking”,
“resourcebooking”: {
“url”: “https://”,
“id”: “RES1”,
“_type”: “resourcebooking”
},
“start”: “2020-05-11T06:00:00+02:00”,
“end”: “2020-05-12T06:00:00+02:00”,
“actualstart”: null,
“actualend”: null
}
]
},
{
“location”: {
“url”: “https://”,
“id”: “3”,
“name”: “Room 3”,
“_type”: “location”
},
“schedules”: [
{
“scheduletype”: “resourcebooking”,
“resourcebooking”: {
“url”: “https://”,
“id”: “RES2”,
“_type”: “resourcebooking”
},
“start”: “2020-05-11T09:00:00+02:00”,
“end”: “2020-05-11T11:30:00+02:00”,
“actualstart”: null,
“actualend”: null
},
{
“scheduletype”: “resourcebooking”,
“resourcebooking”: {
“url”: “https://”,
“id”: “RES3”,
“_type”: “resourcebooking”
},
“start”: “2020-05-11T13:00:00+02:00”,
“end”: “2020-05-11T15:30:00+02:00”,
“actualstart”: null,
“actualend”: null
}
]
},

     ]
  }

]}

I am doing similar experiments with other data. I think the easiest way to do this, is not try to rely too much on the built-in widgets. You can easily just create some HTML and use the embedded HTML Widget, which works nicely and also can have a transparent background (unless your player is windows based.)

This way you have full control: Just write a small HTML Template, Inline the CSS and either directly put the html you want in there or use some kind of templating like handlebars.

You could even create a smart layout, that highlights the next room usage and greys out passed sessions.

Just as an idea of how you could approach this.

Widget Docs: https://xibo.org.uk/manual/en/media_module_embedded.html
API Docs: https://xibo.org.uk/manual/api/#/widget/widgetEmbeddedEdit

Hej,
We tried using the embedded html widget but we are having an issue with that.
We created a javascript script that tried to get the info from the API we are connecting to.

The problem with this is that we get a CORS error. Any ideas on how to fix or get around this issue?

Thx

Well what I meant, is that you put the embedded html including the data, not getting it over an API. So you have three possibilities, that I see:

Change the CORS headers of your server

If you understand the security implications, then you can configure your webserver to send other headers, that will tell the browser to allow request to another domain: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#The_HTTP_response_headers
But this of course depends on your server or middleware, if you can configure this easily.

Provide the Data via JSONP

There is a Javascript Possibility to provide the data as a script with a callback, but for this you need code changes on the side of the API that provides the data.

Push a new embedded HTML Widget every time the data changes

You can use the Xibo API https://xibo.org.uk/manual/api/#/

So you can change the actual HTML every time you have updated data. But this will mean:

Then the player will download the updated layout.

I am also new to Xibo, so there may be another solution that I am not aware of.

The Xibo Community site uses cookies. What are cookies?