core-dataset
DataSet
Core
Display DataSet content
fa fa-table
\Xibo\Widget\DataSetProvider
\Xibo\Widget\Compatibility\DatasetWidgetCompatibility
%dataSetId%_%lowerLimit%_%upperLimit%_%numItems%_%orderClauses%_%useOrderingClause%_%ordering%_%filterClauses%_%useFilteringClause%_%filter%_%displayId%
dataset
dataset
datasetticker
datasetview
2
1
1
html
10
DataSet
Please select the DataSet to use as a source of data for this template.
Configuration
Lower Row Limit
Please enter the Lower Row Limit for this DataSet (enter 0 for no limit).
0
0
Upper Row Limit
Please enter the Upper Row Limit for this DataSet (enter 0 for no limit).
0
0
Randomise?
Should the order of the feed be randomised? When enabled each time the Widget is shown the items will be randomly shuffled and displayed in a random order.
0
Number of Items
The Number of items you want to display
0
1
0
Duration is per item
The duration specified is per item otherwise it is per feed.
0
Order
The DataSet results can be ordered by any column and set below. New fields can be added by selecting the plus icon at the end of the current row. Should a more complicated order be required the advanced checkbox can be selected to provide custom SQL syntax.
[]
dataSetId
0
Use advanced order clause?
Provide a custom clause instead of using the clause builder above.
0
Order
Please enter a SQL clause for how this dataset should be ordered
1
Filter
The DataSet results can be filtered by any column and set below. New fields can be added by selecting the plus icon at the end of the current row. Should a more complicated filter be required the advanced checkbox can be selected to provide custom SQL syntax. The substitution [DisplayId] can be used in filter clauses and will be substituted at run time with the Display ID. When shown in the CMS it will be substituted with 0.
The substitution [Tag:tagName:defaultValue] can also be used in filter clauses. Replace tagName with the actual display tag name you want to use and defaultValue with the value to be used if the tag value is not found (e.g., [Tag:region:unknown]). At runtime, it will be substituted with the Display's tag value or defaultValue if the tag value is not found. When shown in the CMS, it will be substituted with an empty string if the tag is not found at all.
[]
dataSetId
0
Use advanced filter clause?
Provide a custom clause instead of using the clause builder above.
0
Filter
Please enter a SQL clause to filter this DataSet.
1
DESC
Caching
Update Interval (mins)
Please enter the update interval in minutes. This should be kept as high as possible. For example, if the data will only change once per hour this could be set to 60.
5
0
Freshness (mins)
If the Player is offline it will switch to the No Data Template after this freshness time. Set this to 0 to never switch.
0
0
&& moment(meta.cacheDt).add(properties.freshnessTimeout, 'minutes').isBefore(moment())
) {
return {dataItems: []};
}
// Filter the items array we have been given
if (parseInt(properties.randomiseItems) === 1) {
// Sort the items in a random order (considering the entire list)
// Durstenfeld shuffle
// https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm
// https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array
for (var i = items.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var temp = items[i];
items[i] = items[j];
items[j] = temp;
}
}
if (properties.takeItemsFrom === 'end') {
// If it's an array, reverse it
if (Array.isArray(items)) {
items.reverse();
} else {
// If it's an object, reverse the keys
var newItems = {};
Object.keys(items).reverse().forEach(function(key) {
newItems[key] = items[key];
});
items = $(newItems);
}
}
// Make sure the num items is not greater than the actual number of items
if (properties.numItems > items.length || properties.numItems === 0) {
properties.numItems = items.length;
}
// Get a new array with only the first N elements
if (properties.numItems && properties.numItems > 0) {
items = items.slice(0, properties.numItems);
}
// Reverse the items again (so they are in the correct order)
if ((properties.takeItemsFrom === 'end' && properties.reverseOrder === 0) ||
(properties.takeItemsFrom === 'start' && properties.reverseOrder === 1)
) {
// console.log("[Xibo] Reversing items");
// If it's an array, reverse it
if (Array.isArray(items)) {
items.reverse();
} else {
// If it's an object, reverse the keys
var newItems = {};
Object.keys(items).reverse().forEach(function(key) {
newItems[key] = items[key];
});
items = $(newItems);
}
}
return {dataItems: items};
]]>
0) {
// Set up an interval to check whether we have exceeded our freshness
if (window.freshnessTimer) {
clearInterval(window.freshnessTimer);
}
window.freshnessTimer = setInterval(function() {
if (moment(meta.cacheDt).add(properties.freshnessTimeout, 'minutes').isBefore(moment())) {
// Reload the widget data.
XiboPlayer.playerWidgets[id].render();
}
}, 10000);
}
]]>