Forum Discussion

DarkShadows's avatar
DarkShadows
Contributor
6 years ago
Solved

TestComplete_WebApplication_DDTDriver_How to pass the Specific Row value in scripts?

Hello Team,

 

I'm stuck at how to pass specific row's value in my script, currently i'm able to pass the first row value however how to pass the second or third row values?

 

Really appracite if someone guide me how to handle this .

 

Regards

Dark,.

 

Below is script samples:

 

function CheckProperty1()
{
ExcelPath = "C:\\Stores\\ExWorksheet.xlsx";
DDT.ExcelDriver(ExcelPath,"Sheet1");
PropertiesProductMgmtCheckout(ProductMgmtProperties.textnode,"contentText", cmpEqual, DDT.CurrentDriver.Value(2));

//* Above script is working fine for first row now below is script i'm tring to pass for row second.however it failed.

function CheckProperty2()
{
ExcelPath = "C:\\Stores\\ExWorksheet.xlsx";
DDT.ExcelDriver(ExcelPath,"Sheet1");
PropertiesProductMgmtCheckout(ProductMgmtProperties.textnode,"contentText", cmpEqual, DDT.CurrentDriver.Value(2,1));

Error details
JavaScript runtime error.
Error: Invalid number of parameters.
  • Hi,

     

    If you need to iterate through all values:

     

    function CheckProps() {
    
        ExcelPath = 'C:\\Stores\\ExWorksheet.xlsx';
        Driver = DDT.ExcelDriver(ExcelPath , "Sheet1");    
        Driver.First();
        
        while (! Driver.EOF()) {
            for (i=0; i<Driver.ColumnCount; i++) {
                Log.Message(Driver.Value(i));
                }
            Driver.Next();
            }
        }

1 Reply

  • baxatob's avatar
    baxatob
    Community Hero

    Hi,

     

    If you need to iterate through all values:

     

    function CheckProps() {
    
        ExcelPath = 'C:\\Stores\\ExWorksheet.xlsx';
        Driver = DDT.ExcelDriver(ExcelPath , "Sheet1");    
        Driver.First();
        
        while (! Driver.EOF()) {
            for (i=0; i<Driver.ColumnCount; i++) {
                Log.Message(Driver.Value(i));
                }
            Driver.Next();
            }
        }