readFile

Syntax

<Path>.readFile(FileName:string[, NoDebugger:boolean:=false]) → boolean

The method readFile imports data from the designated file into the list or table designated by <Path>. Note that Plant Simulation overwrites any existing data.

The method readFile can import text files, which you exported with the method writeFile, as well as object files, which you exported with the method writeObjectFile.

The method applies to the objects DataStack, DataQueue, DataList, DataTable, and TimeSequence.

Parameters

  • The parameter FileName of data type string designates the path to and the name of the text file (*.txt).

  • The optional parameter NoDebugger of data type boolean sets if the Debugger opens after an unsuccessful access or not.

    When you do not specify the optional parameter of data type boolean, the Debugger always opens.

    When you enter true, the Debugger does not open and the method returns the value false when an error occurs.

    Default Value

    The default value is false.

Return Value

The return value has the data type boolean.

Example

MyDataList.readFile("C:\users\johnE\times.txt")
MyDataTable.readFile("C:\temp\product_plan.psobj")
if MyDataStack.readFile("C:\temp\data.txt", true) = false 
   -- could not read file
end

Related Topics

Import File

writeFile

writeObjectFile