Forum Discussion

PAULINA's avatar
PAULINA
Occasional Visitor
10 years ago

How to use more than one variable in the same loop?

Hi

 

I' m testing a desktop app, one of its screens includes textbox and combobox:

 

1. TEXTBOX'S   of personal information :  to fill the textbox's  that need personal information (first name, last name, telephone number, etc) I'm using an EXCEL document trough a variable.

2. COMBOBOX:  and to fill the combobox I'm using a DB TABLE variable with a  query in SQL (select  top(1) idestado from [Catalogo].[Estados] ORDER BY NEWID() )

3. TEXTBOX  of e-mail: finally to fill this textbox I'm using another DB TABLE variable  with a table generated with the TestComplete option that create a list with differents mails.

 

In the KeyWordText I've  decided to use a Data-Driven-Loop and it works great with the textbox's of personal information   but with the combobox and the textbox of e-mail I think is not working correctly because the TestComplete always put the same information, I mean the TestComplete doesn't take all the rows of the  DB TABLE variable   for the email and always take the first row.  I think that maybe it happens because in the Loop I didn't put the DB TABLE variable  for the combobox and the e-mail textbox but how I can use more than one variable in the same loop?

 

Thank you :)

1 Reply

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    http://support.smartbear.com/viewarticle/56906/

     

    Take a look at the last section, Adding Operations to an Existing Data-Driven Loop.

     

    You were right about needing more than one variable in the loop.  You will need one for each Excel sheet or table that you want to reference.

     

    One other thing that might be causing you a problem - the sql query you mentioned for the combobox uses select top(1), which is only ever going to give you one record.  You'll also have to loop through that db if you want to get more than one option from the table.