Table variables - retrieve row number using the Iterator
Hi all,
I'm working with Table variables: https://support.smartbear.com/testcomplete/docs/testing-with/variables/data-types/table.html
and executing a loop to get the variable values using the Iterator object (see below for the code).
I need to have, within the loop, the row number that the iterator is processing, but I've not found a way to retrieve it. How can I retrieve the actual row number into the loop?
This is the code (I've simplified it to let you easily understand):
let table = <keywordtest var>;
let iterator = table.Iterator;
iterator.Reset();
while (!iterator.IsEOF())
{
firstColumnValue = iterator.Value(<firstColumn>);
secondColumnValue = iterator.Value(<secondColumn>);
//here I would like to retrieve the actual row number that the iterator is processing
iterator.Next();
}
Hi,
> to retrieve the actual row number that the iterator is processing
Iterator object does not provide such property, so you'll need to implement it yourself:
iterator.Reset();
let iRowNo = 0;
while (!iterator.IsEOF())
{
firstColumnValue = iterator.Value(<firstColumn>);
secondColumnValue = iterator.Value(<secondColumn>);
//here I would like to retrieve the actual row number that the iterator is processing
Log.Message(iRowNo);
iterator.Next();iRowNo++;
}