Micro Focus QTP (UFT) Forums
Selecting a field in database for a loop - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Selecting a field in database for a loop (/Thread-Selecting-a-field-in-database-for-a-loop)



Selecting a field in database for a loop - HeZma - 02-14-2012

This is a total newbie question and I apology that: but if I have values in datatable fields A1 - A10 (which I want to run in QTP), but want to start he counting from A2 field, how do I do it? This script is for QTP flight demo:

Code:
For i = 1 to datatable.GetRowCount
Dialog("Login").WinEdit("Agent Name:").Set DataTable("A", dtGlobalSheet)
Dialog("Login").WinEdit("Password:").Set DataTable("B", dtGlobalSheet)
wait 2
datatable.SetNextRow
Next
Dialog("Login").WinButton("Cancel").Click
ExitRun
How should I modify this? I know I should somehow add GetParameter("A").ValueByRow(3), but couldn't get it to work. Thanks for your answers!


RE: Selecting a field in database for a loop - rajpes - 02-15-2012

Question is not clear.
Did you mean you want to start fetching values from 3rd row onwards?(leaving the first 2 rows?)
If so you can write like this
Code:
For i = 3 to datatable.GetRowCount
Datatable.setcurrentrow=i
Dialog("Login").WinEdit("Agent Name:").Set DataTable("A", dtGlobalSheet)
Dialog("Login").WinEdit("Password:").Set DataTable("B", dtGlobalSheet)
wait 2
Next



RE: Selecting a field in database for a loop - basanth27 - 02-15-2012

This forum is meant for people to come up and ask questions and the name of this section is beginners which clearly means that you have no idea about QTP. Please dont be sorry about it. I would actually request you to come up with any question you have irrespective of the weight it carries. However, before you ask search this forum. It is a good practice as several people have moved from asking questions to answering questions and hence the repository should contain answers for the basic questions. If you do not get what you want please do not hesitate to ask.

Ask questions, clarification is better than assumption.

For the answer you look for it should be i = 2 to... I believe A2 refers to second row, aint it?


RE: Selecting a field in database for a loop - HeZma - 02-19-2012

Thanks a lot for your answers. It helped a lot Smile I know that I probably should have written more detailed, but I guess you guys still were able to understand what I was looking for.