Fuego.Io : DelimitedFile

The DelimitedFile component is used to read and write data from or to a delimited file.

Each line of a delimited file contains lists of values, each of which is delimited by a character such as a comma. Each line of information is also delimited by a special character such as the new line character. Delimited files are usually generated from export tools in database or spreadsheet software. For example, if you export information from a Microsoft Excel spreadsheet, the information is saved in a delimited text file with the .txt extension. The fields in the spreadsheet are delimited by commas, and the rows are delimited by new line characters.

Example 1

This example reads through a delimited file in which each line is of the form NAME, QUANTITY. By default, DelimitedFile uses commas as field separators and new line characters as line separators.

for each row in DelimitedFile("c:/tmp/delimitedFile.txt").lines
do
    name = row.field[0]
    qty = row.field[1]
    display ("Name: " + name + "\nQuantity: " + qty)
end

Example 2

This example reads through a delimited file in which each line is of the form NAME, QUANTITY. By default, DelimitedFile uses commas as field separators and new line characters as line separators.

for each row in DelimitedFile("c:/tmp/delimitedFile.txt").lines
do
    name = row.field[0]
    qty = row.field[1]
    display ("Name: " + name + "\nQuantity: " + qty)
end

Example 3

In this example, the DelimitedFile component is used in conjunction with the Line component. The DelimitedFile component is used to open a file and iterate through each line of the file. An instance of Line represents a line, and is used to iterate through each field in the line.

fileA as DelimitedFile
fileA = DelimitedFile("c:/tmp/delimitedFile.txt")
for each row in fileA.lines do
    display row.field
    for each f in row.field do
        display f
    end
end
Related reference
Fuego.Io : Line