How to iterate actions ?

I would like to bring about a common confusion which happens among beginners in QTP... the concept of iterations and its settings in QTP. You can change the way QTP iterates an action but wait...... do you want to iterate on the local data table or global data table ? Once you become more used to programming in QTP, you will mostly use DataTable.GetSheet.GetRowCount and then do whatever you want..but for those who dont prefer to do it programmatically, do it by changing the QTP settings...

Remember File->Settings->Run is the setting for the Global Data Table and
Action Call Properties -> Run is the setting for the Local Data Table

Now how to iterate

Not worried about data table?
If you are not concerned about the number of rows in the data table, then use a for loop inside your action
For times = 1 to x
action statements
Next

Depends on Global Data Table?
However if you are wanting it to be based on the no. of rows in the global data table, use the File->Settings->Run Option to run on all rows...

Depends on Local Data Table?
If you are wanting it to be based on the no.of rows in the action's local data table, go to the Action Call Properties and modify the selection in Run

Note:Never forget the DataTable.SetCurrentRow() statement if you want to programmatically achieve this... you can get wierd results otherwise :)

I dont want to have any sort of copyright or copyleft in this site but if you are reusing this code in any other site, I would appreciate you to provide this page as a link so that others get a more descriptive explanation of this concept. Your suggestion and comments are always welcome. Cheers !!!
As always,
Your friend in need,

George, Reju

Read Users' Comments (0)

0 Response to "How to iterate actions ?"

Post a Comment

Visitors

Website Counter