Skip to main content
Version: 4.x

Read file (READ)

The read file operator creates an action that reads a file from a defined source and writes this file to the specified local data property without parameters.

The source is defined as a property which values are instances of string classes. The following types of data sources (URLs) are supported: FILE, HTTP, HTTPS, FTP, SFTP, JDBC, MDB.

Language

To declare an action that reads a file, use the READ operator.

Examples

readFiles()  {

LOCAL importFile = FILE ();

//reading from FTP
READ 'ftp://ftp.lsfusion.org/file.xlsx' TO importFile;
//reading from SFTP
READ 'sftp://sftp.lsfusion.org/file.xlsx' TO importFile;
//reading from FILE
READ 'D://lsfusion/file.xlsx' TO importFile;
READ 'file://D://lsfusion/file.xlsx' TO importFile;
}

connectionString = DATA STRING[100]();
importXls 'Import markups'() {
LOCAL importFile = FILE ();
READ connectionString() + '@SELECT field1, field2 FROM myTable' TO importFile;

LOCAL field1 = INTEGER (INTEGER);
LOCAL field2 = BPSTRING[10] (INTEGER);
IMPORT TABLE FROM importFile() TO field1, field2;
}