Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Data table Iteration
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi Friends,

In data table i want column # 1 should repeat one time and column # 2 should repeat 3 times,the Column # 2 will always call the action function for each step..
please any body give solutions for this..

By
Shandru
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi
As per my knowledge, there is an option to iterate the scripts row wise in Settings tab. If any one knows this can be done column wise, please let us know.
But Shandru, this can be achieved by using the excel file instead of datatable.
Reply
#3
Solved: 11 Years, 3 Months, 3 Weeks ago
Thanks for response kavita...
I will try by importing excel sheet...
Reply
#4
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi Shandru,

Try this:
PHP Code:
For 1 To 3
   DataTable
.GlobalSheet.SetCurrentRow(i)
   
DataTable.GetParameter("ColumnName")
Next 
Reply
#5
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi Shandru,

First thing, The iterations will be done based on rows not on columns...
we can do iterations based on columns also, but need more programming. for your case I developed small piece of code, check it once and revert me if you need additional info,

This type of questions will be get in Interviews not in real time. we've many work arounds to solve these situations.

Code:
' Iterations based on Columns in Datatable
' First column will run once and second column runs thrice calling the Actions/Functions in it for every iteration.

Dim RC, CC, i, j, var

RC = Datatable.GetRowCount
CC = Datatable.GetSheet(dtGlobalSheet).getparametercount

print "Row count of the Datatable is :"&RC
print "Column Count of the Datatable is :"&CC

Function One()
   print "First Function is executed"
End Function

Function Two()
   print "Second Function is Executed"
End Function

Function Three()
   print "Third Function is Executed"
End Function

For i=1 to CC

    For j=1 to RC

        If (i=1) Then

            print i&"st Column iteration"
            print j&" Row cell value of "&i&" Column is :"& Datatable.Value(i,dtGlobalSheet)
            Datatable.SetNextRow
            
        End If

        If (i=2) Then
            For des = 1 to 3
                For k=1 to RC
                    var=datatable.Value(i,dtGlobalSheet)
                    'print "The Function Name is :"&var
                    Execute Cstr(var)  'or 'Call Cstr(var)
                    Datatable.SetNextRow
                Next
            Next
        Exit For
        End If

    Next
    if(i=2) Then
        Exit For
    End If
Next
Reply
#6
Solved: 11 Years, 3 Months, 3 Weeks ago
hi bfakruddin
Thxs for detailed responce...i tried your code by modifying some variable changes now its working fine ..once again thx a lot

regards,
Shandru
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with Select checkbox from data table value jayraocourts 0 1,244 11-01-2019, 10:25 PM
Last Post: jayraocourts
  Different Amount for same iteration Rose 1 2,215 03-31-2016, 02:42 PM
Last Post: vinod123
Sad UFT IS NOT ABLE TO FIND THE RUNTIMEOBJECT(myo) IN FOR LOOP FOR THE SECOND ITERATION lakshmi29 0 2,257 09-14-2014, 10:00 PM
Last Post: lakshmi29
  How to get center data value in a odd number of rows and columns web table ... sai rajesh 0 2,786 11-13-2013, 10:24 PM
Last Post: sai rajesh
  DP is not returning the whole table data content soumen 6 5,097 10-02-2013, 12:05 PM
Last Post: vvcyril

Forum Jump:


Users browsing this thread: 1 Guest(s)