Project:Data feeds

From SpinetiX Support Wiki

Jump to: navigation, search

Introduction

The sample projects provided on this page were designed to show the data feeds functionality using the feed widgets available in Elementi.

  • For HMD sample projects, check out the history of these projects for previous versions (when applying).

Specifications

Various data feeds

Data Feeds Projects archive contains the following projects:

  • local ical: local data from an iCalendar file,
  • local xml: data from a standard xml file,
  • pullmode xml: data from an xml file on a remote server,
  • pullmode regexp: data extracted from an html page using regular expression parser,
  • pullmode custom: data in JSON format parsed using a custom parser,
  • pushmode http: update of live data using a custom HTML page (based on Shared Variables).

RSS feeds

A sample project describing how to add a text ticker displaying RSS news from the Internet can be found on the "RSS ticker" tutorial page.

Inline data

You can display inline data using the widgets for inline data. The "Inline Text Ticker" and "Inline Text Roll" widgets demonstrate how to display a horizontal / vertical scrolling text that the user can change directly from the interface (i.e. the "Properties" view of the document).

CSV feeds

These sample projects demonstrate how to display a CSV feed using Elementi feeds widgets.

CSV Feed Project

The CSV Feed Project is displaying a sales report in Elementi provided in CSV format (SalesJan2009.csv) with multiple items / records per page.

  • The "CSV Table.svg" widget is set to use the built-in CSV parser.
  • The text layers inside the ‎"CSV Table.svg" widget are set accordingly to the column names present on the first row of the CSV file (e.g., [[Transaction_date]], [[Product]], [[Price]] etc.) and arranged on one line.
  • On the "Properties" view, the "Number of rows" (under "Table parameters" group) is set to 13 to accommodate multiple lines of data on the same page.

Custom parser CSV Feed Project

The Custom parser CSV Feed Project is displaying a meetings agenda provided in CSV format (meetings.csv), with multiple items / records per page (maximum 5). The CSV Table.svg widget is set to use a custom script (custom.js) to limit the meetings records per level (this info is in the first column on the CSV file). This way, the same project can be published on all the players, yet each HMP will only display the meetings of a certain level, according to the first character of HMP name (DEVICE_NAME).

  • If the HMP name doesn't start with a valid level, then no records are displayed. When played in Elementi, the custom script is returning all the records.
  • The custom script code is the following:
var c = DEVICE_NAME.charAt(0);
var is_player = ( DEVICE_NAME == '[not defined]' ? false : true );

function parse( response ) {
  var csvDocument = $.parseCSV( response );
  var result = [];
  for ( var row = 0; row < csvDocument.length; row++ ) {
    if ( !is_player || csvDocument[row]['level'] == c ){
      result.push( csvDocument[row] );
    }
  }
  return result;
}

Text feeds

List Of Movies Project

Parser RegExp configuration

This sample project is displaying details regarding the movies that are playing in a cinema theater.

  • The information is provided in a text file (sample.txt) having a specific format commonly used within the cinema industry.
  • The information is displayed as a slideshow having multiple items / records per page (customizable from "Properties" view > "Table parameters" > "Number of rows" property).
  • The "RegExp Table.cvs" file (based on a table widget) is using a RegExp parser together with a match expression built according to the format of the file.
  • The text layers inside "RegExp Table.cvs" are set accordingly to the column names present under "Specify output" table (e.g., [[title]], [[room]], [[start-hour]] etc.) and arranged on one line.

The file format used within this sample project is the following:

Field Name Start Position End Position
Cinema Screen 1 3
Show Number 4 6
Start Time 7 10
Film Duration 12 14
Number Seats Sold 17 21
Number Seats Available 22 26
Censor Rating 29 32
Film Name 33 62

A sample line: 1 6 0005 139 4 270 0 R16 Body Of Lies

The matching expression used is: (.{3})(.{3})(.{2})(.{2})\s(.{3})\s{2}(.{5})(.{5}).{2}(.{4})(.*)

This page was last modified on 28 September 2015, at 12:42.