CSV Channels

Lightwing can also import dynamic information from files in CSV (Comma Separated Values) format via a CSV channel and display that information with text or ticker commands. This example reads a CSV file created with Excel and creates a CSV channel named Excel to display its contents in a text block on a page with a text command.

The csv command opens the CSV file named ExcelTest, creates a CSV channel of the same name and defines a periodic update time interval for this channel with the update option. An extension of .csv is assumed for CSV files and they are located in the data folder. This command can be repeated for any number of CSV files and their corresponding channels remain in effect throughout the entire script. Since this command is global in nature, it should appear before the first page. These CSV channels can then be used by subsequent text and/or ticker commands in the script.

To display information from the CSV file, text and ticker commands must use the csv option to specify the name of the CSV channel and CSV text variables for the type options. The CSV text variables have names that begin with the term Csv, including CsvItem, CsvRow, CsvColumn and CsvBlock. These variables display individual items, rows of items, columns of items and blocks of items, respectively. The index option of the text or ticker commands indexes the row and column of the first data item in the CSV channel to be displayed.

Notice that the lines option is used to allow the text command to use multiple lines to display the number of rows of items required for the CSV file. Also refer to the online Scripting Guide for more details about these commands.

// Scripting Tutorial - CSV Channels

version: 1.0
csv: ExcelTest     update: 1:00:00    limit: 4

page: TestBlock    time: 1 5     image: PlanetMercuryBackground.pvr
    text: OpenSansBold_40        position: 20 40   type: "Col A:      Col B:      Col C:      Col D:"
    text: OpenSansBold_40        position:  5 50     type: "Row 1:"
    text: OpenSansBold_40        position:  5 55     type: "Row 2:"
    text: OpenSansBold_40        position:  5 60     type: "Row 3:"
    text: OpenSansBold_40        position:  5 65     type: "Row 4:"
    text: OpenSansBold_40        position: 20 50   type: CsvBlock     lines: 4  csv: ExcelTest    index: 0, 0
    jump: TestBlock

 

 

<   RSS Channels                                             Introduction                                            Touch Branching  >