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();
}
Solved! Go to Solution.
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++;
}
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++;
}
Thank you @AlexKaras !
User | Count |
---|---|
7 | |
5 | |
2 | |
1 | |
1 |
Subject | Author | Latest Post |
---|---|---|