Forum Discussion

Azeddin_Margani's avatar
Azeddin_Margani
Contributor
8 years ago

continuous reading of data for keyword loop

Hi,

 

Could someone please help -  I'm using  keyword tests in a loop to read data from excel sheet. How can I stop the execution when no more data rows left to read. Currently, the execution continues to look for data, then stops ?.

 

Regards,

2 Replies

  • NisHera's avatar
    NisHera
    Valued Contributor

    If you are using DDT Driver there is  a End of file method

    Driver.EOF() 

    so ones you get to EOF you gave to brake the loop.

    There is are samples in your Testcomplete sample folder

    for more infor see this

    • Colin_McCrae's avatar
      Colin_McCrae
      Community Hero

      And if you're using Excel as a COM object you either stop when you read in a blank value (you're doing keyword driven tests so you must be reading these in right?)

       

      Or if you want, the Excel sheet has a UsedRange property you can read in advance which tells you how many active rows it is regarded as having.

       

      https://msdn.microsoft.com/en-us/library/office/ff840732.aspx

       

      Of course, if you have blank lines within that used range, you'll have to factor something into your code to account for that.