Micro Focus QTP (UFT) Forums

Full Version: How to pass all rows from data sheet in a function argument
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi Friends

I want to write a code which take all the values from the data table row by row as an argument of the function.

If I am using only one row data it is working fine :
BELOW IS THE CODE
Code:
SelectSourceAttribute  is a function
sSourcename=  DataTable("SourceName",  dtGlobalSheet)
sAttrbuteSearch= DataTable("AttributeName", dtGlobalSheet)
msgbox sSourcename
msgbox sAttrbuteSearch
SelectSourceAttribute sSourcename,sAttrbuteSearch

But when same code is used under a for loop its not working, please anybody tell me whats the problem

Code:
For i =1 to RowCount
    sSourcename=  DataTable("SourceName",  dtGlobalSheet)
    sAttrbuteSearch= DataTable("AttributeName", dtGlobalSheet)
    msgbox sSourcename
    msgbox sAttrbuteSearch
    SelectSourceAttribute sSourcename,sAttrbuteSearch
Next

Note: run one iteration is checked when loop is added
try the below code.....................

Code:
For i =1 to RowCount
sSourcename= DataTable("SourceName", dtGlobalSheet)
sAttrbuteSearch= DataTable("AttributeName", dtGlobalSheet)
msgbox sSourcename
msgbox sAttrbuteSearch
DataTable.SetNextRow
Next

Srinath