Next Method

Applies to TestComplete 14.61, last modified on April 22, 2021

Description

This method is used for iterating through records of the data storage to which the ProgObj driver provides access. Next lets you move the driver to the next set of data to be retrieved. For more information on using this method, see Using DDT Drivers.

Declaration

ProgObj.Next()

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

Applies To

The method is applied to the following object:

Result Value

None.

Example

The code below creates an Excel driver and then iterates through the records of the specified file via the properties and methods of the DDTDriver object.

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
First Method
EOF Method
DriveMethod Method

Highlight search results