Data Command

Lightwing can periodically read two-dimensional arrays of string data from files in the CSV (comma separated values) format and display that information with Text commands. CSV is a plain text file format that can be exported from many popular database and spreadsheet applications, like Microsoft Excel and Google Docs. This makes it easy to create signs which display dynamic information which is updated periodically without the need to edit scripts to update sign content.

        Example of a CSV Data File with a 5 x 4 Array

        "Item A1","Item B1","Item C1","Item D1","Item E1"
        "Item A2","Item B2","Item C2","Item D2","Item E2"
        "Item A3","Item B3","Item C3","Item D3","Item E3"
        "Item A4","Item B4","Item C4","Item D4","Item E4"

The Data command defines a name for a data channel with an optional periodic update time interval. Data channels are global, so Data commands should appear at the top of the script file to make the channels available to all pages in the script. Data channel names can be any mix of alpha and numeric characters and some symbols including underscore and hyphen. A CSV extension is appended to the end of the name to construct the file name that will be opened and read. Data files must be located in the data folder. By default, Data files are not updated periodically and are limited to 100 items per channel. Use the command options below to change this.

The following example creates a data channel named Excel and reads its data from the file shown above named Excel.csv on one hour update intervals.

       Example of a Page that Displays Data Channel Information
  
        data: Excel    update: 1:00:00    limit: 5

        page: PageName    time 1, 10
            text: OpenSansRegular_40    lines: 4    data: Excel    type: DataBlock    index: 0, 0

Several variable names are available to display data file information using the variable option with Text commands. The Ticker command does not support data channels.

Data Text Variables

        Names                  Displays
        
        DataItem                  A single data item.
        DataRow                  A row of multiple data items.
        DataColumn            A column of multiple data items.
        DataBlock                A two-dimensional array of items.

The DataItem variable provides the most flexibility to format data on the page in any manner, but requires a separate Text command for each item displayed. The DataBlock variable will display an entire two-dimensional array of items with a single Text command, but always formats the items in consecutive order starting at the top left corner and proceeding from left to right and then top to bottom for each row of items. This assumes that the data file is already in that order.

DataRow and DataColumn offer compromises in formatting flexibility requiring a Text command per row or column, respectively. DataBlock and DataRow always add 3 spaces between items for horizontal spacing, which is not configurable. Alternatively, DataColumn spaces items vertically according to the height of the font, which allows columns to have arbitrary horizontal spacing controlled by the position options of the Text commands. Refer to the TestData.lws script in the Lightwing SDK for examples of using these variables to display formatted data arrays.

Limit Option

Defines the maximum number of items that a data channel will contain in the horizontal and vertical directions, respectively. Data channels are limited to 1000 items per channel in total, by default. These values can be used to limit the size of the data set that is read from the data file to any smaller sizes. If only a single value is specified, it defines the size of the channel array in both dimensions.

Update Option

Defines a time interval to update the channel data by reading from the file. This can be specified as either a floating-point value in seconds or integer (sexagesimal) clock time. This interval is zero by default, which means to never update the channel.

Example Time Specifications

        Time Duration                               Float                Clock

        One Half Second                                 0.5                    n/a
        One Second                                         1.0                        1
        One Minute                                           60                  1:00
        One and One Half Minutes                90                  1:30
        One Hour                                          3600             1:00:00
        One and One Half Hours               5400              1:30:00
        One Day                                          86400           24:00:00

 

 

<   Chain Command                                             Introduction                                            Global Command   >