Micro Focus QTP (UFT) Forums
UFT Datatable iterations - 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: UFT Datatable iterations (/Thread-UFT-Datatable-iterations)



UFT Datatable iterations - Studymode - 11-17-2017

Hi all,

    This is my very first question on this website, as I found this site to very helpful. My question is how can I iterate through different value from the data table. 


For example this is what I have 

FirstName lastName Age 
John.        Doe.        27
Jane.        Doe.        37
Mary         Jane.       36

So I want the datatble to write 27 for the first row 37 on the second and so on.
Can someone please help me write a loop for this so I can achieve the desired results. Thank you in advance


RE: UFT Datatable iterations - supputuri - 11-22-2017

(11-17-2017, 05:04 AM)Studymode Wrote: Hi all,

    This is my very first question on this website, as I found this site to very helpful. My question is how can I iterate through different value from the data table. 


For example this is what I have 

FirstName lastName Age 
John.        Doe.        27
Jane.        Doe.        37
Mary         Jane.       36

So I want the datatble to write 27 for the first row 37 on the second and so on.
Can someone please help me write a loop for this so I can achieve the desired results. Thank you in advance

you have to use SetCurrentRow method in the Datatable and then enter the value in the desired column.

Code:
datatable.setcurrentrow (1) 'Change the row number as per your requirement
datatable.Value ("ColumnName","Value") 'Eg: DataTable.Value("Age","27")

Hope this is what you are looking for.


RE: UFT Datatable iterations - Studymode - 12-12-2017

(11-22-2017, 02:34 PM)supputuri Wrote:
(11-17-2017, 05:04 AM)Studymode Wrote: Hi all,

    This is my very first question on this website, as I found this site to very helpful. My question is how can I iterate through different value from the data table. 


For example this is what I have 

FirstName lastName Age 
John.        Doe.        27
Jane.        Doe.        37
Mary         Jane.       36

So I want the datatble to write 27 for the first row 37 on the second and so on.
Can someone please help me write a loop for this so I can achieve the desired results. Thank you in advance

you have to use SetCurrentRow method in the Datatable and then enter the value in the desired column.

Code:
datatable.setcurrentrow (1) 'Change the row number as per your requirement
datatable.Value ("ColumnName","Value") 'Eg: DataTable.Value("Age","27")

Hope this is what you are looking for.

Thank you so much, this is exactly what I needed, sorry for the delay in reply my password got mixed up but I really do appreciate your help.