LassoScript Utility
Basics Browse Detail

[File]

Tag Link [File] Category File
Type Substitution Source Available Yes
Support Preferred Version 7.0
Change Unchanged Data Source Any
Output Type File Security Tag, File
Implementation LCAPI Sets Lasso 8.5, Lasso 8.0, Lasso 7.0

Description

Casts a file as an object. Requires the name and path to a file as a parameter, in addition to the open and read mode indicators.

When a file connection is opened using the [File] tag, several different open modes can be used. These modes optimize the file connection for best performance depending on the purpose of the connection. A read mode may also be specified to determine how the file will be read (by line or by character). The open and read modes are described below.

Syntax

[Var:'File Variable'=(File: 'file name', Open Mode, Read Mode)]

Parameters

Required Parameters
'File path' The name and path to a file.
Open Mode The open mode defines the purpose and permissions of the file connection, and may be one of the following values:

  • File_OpenRead – Sets the file connection to read-only.

  • File_OpenWrite – Sets the file connection to write-only.

  • File_OpenReadWrite – Sets the file connection to read and write.

  • File_OpenWriteAppend – Sets the file connection to write and append data.

  • File_OpenWriteTruncate – Sets the file connection to write and truncate data.
  • Read Mode The read mode defines whether the file will be read by line or by character when using the [File->Get] tag, and may be one of the following values:

  • File_ModeChar – Reads a file character by character.

  • File_ModeLine – Reads a character line by line.
  • Examples

    To cast a file as an LDML object:

    Use the [File] tag. The example below casts a local file named myfile.txt as an LDML object in read-only/character mode. Note that no single quotes are used around the open and read mode designators, as they are type constants and not strings.

    [Var:'File'=(File: 'myfile.txt', (File_OpenRead), (File_ModeChar))]