Ask a Question

DBTable - Interacting with a DBTable if it is a passed parameter to a function\routine

SOLVED
DKNP
Occasional Contributor

DBTable - Interacting with a DBTable if it is a passed parameter to a function\routine

Hi

 

I currently have a DB table variable which is a variable of a keyword test. The DBTable is pointing to a spreadsheet stored on the local computer.

 

The keyword test calls a function and I pass the DBtable variable as a parameter.

 

The DBTable object is visible and passed when I inspect it via the watch list as it shows the columncount.

 

My problems come when i try to interact with the passed variable as nothing i have tried appears to work.

 

Do you have any documentation or examples to show how to interact with the passed DB Table variable.

 

I want to iterate through all the columns and rows and extract the stores values.

3 REPLIES 3
tristaanogre
Esteemed Contributor

Can you post what you've done to date?  That would be helpful in determining, perhaps, why it's not working and give a better proposed solution.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

Just as a note, I tried it and it's working fine for me.  I have an Excel spreadsheet with two columns in it: Value1 and Value2.  I have that spreadsheet assigned to a DBTable variable on a keyword test.  I then pass that variable to the following function.  My log shows the values of each column for each row as I iterate through the rows from beginning to end.

 

function testDBTable(myTable) {

    while (!myTable.IsEOF()) {
        Log.Message('Column 1 data: ' + myTable.Value('Value1'));
        Log.Message('Column 2 data: ' + myTable.Value('Value2'));
        myTable.Next();
    }
}

Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
DKNP
Occasional Contributor

Thanks, that works.

cancel
Showing results for 
Search instead for 
Did you mean: