EOF Method

Applies to TestComplete 15.48, last modified on March 01, 2023

Description

This method is used for iterating through records of the data storage to which ProgObj provides access. It lets you determine whether the DDTDriver driver is at the end of the data storage and that there is no more data to retrieve. For more information on using this method, see Using DDT Drivers.

Declaration

ProgObj.EOF()

ProgObj An expression, variable or parameter that specifies a reference to one of the objects listed in the Applies To section
Result Boolean

Applies To

The method is applied to the following object:

Result Value

True if the ProgObj driver is at the end the data storage; false otherwise.

Example

The code below creates an Excel driver and then uses it to iterate through the records of the Excel file that stores the desired data.

JavaScript, JScript

function DDTDriverExample()
{
  // Creates a driver
  var Driver = DDT.ExcelDriver("C:\\MyFile.xls", "Sheet1");
   
  // Iterates through records
  while  (! Driver.EOF())
  {
  //Gets a value from the storage and posts it to the log
    Log.Message(Driver.Value(0));
    DDT.CurrentDriver.Next();
  }
   
  // Closes the driver
  DDT.CloseDriver(Driver.Name);
}

Python

def DDTDriverExample():
  # Creates a driver 
  Driver = DDT.ExcelDriver("C:\\MyFiles\\MyFile.xls", "Sheet1")
  # Iterates through records 
  while not Driver.EOF():
    # Gets a value from the storage and posts it to the log 
    Log.Message(Driver.Value[0]) 
    DDT.CurrentDriver.Next()
  # Closes the driver 
  DDT.CloseDriver(Driver.Name)

VBScript

Sub DDTDriverExample
  
  ' Creates a driver
  Set Driver = DDT.ExcelDriver("C:\MyFile.xls", "Sheet1")
   
  ' Iterates through records
  While Not Driver.EOF()
   
  ' Gets a value from the storage and posts it to the log
    Log.Message(Driver.Value(0))
    DDT.CurrentDriver.Next()
  WEnd
   
  ' Closes the driver
  DDT.CloseDriver(Driver.Name)
  
End Sub

DelphiScript

function DDTDriverExample;
var Driver;
begin

  // Creates a driver
  Driver := DDT.ExcelDriver('C:\MyFile.xls', 'Sheet1');
   
  // Iterates through records
  while Not Driver.EOF() do
  begin
  //Gets a value from the storage and posts it to the log
    Log.Message(Driver.Value(0));
    DDT.CurrentDriver.Next();
  end;
  
  // Closes the driver
  DDT.CloseDriver(Driver.Name);

end;

C++Script, C#Script

function DDTDriverExample()
{
  // Creates a driver
  var Driver = DDT["ExcelDriver"]( "C:\\MyFile.xls", "Sheet1" );
   
  // Iterates through records
  while  (! Driver["EOF"]())
  {
  //Gets a value from the storage and posts it to the log
    Log.Message(Driver["Value"](0));
    DDT["CurrentDriver"]["Next"]();
  }
  
  // Closes the driver
  DDT["CloseDriver"]( Driver["Name"] );
}

See Also

Using DDT Drivers
Next Method
First Method
DriveMethod Method

Highlight search results