Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on DataTable Question within the QTP forums, part of the Software Testing category; Hey, I'm new to using QTP. I'm working on testing SAP transactions.My question is in regards to DataTables. I'm importing an xls into the Global Sheet and I want the ...
|
|||||||
|
|||
|
Hey,
I'm new to using QTP. I'm working on testing SAP transactions.My question is in regards to DataTables. I'm importing an xls into the Global Sheet and I want the test to loop through each row of data. The problem is that when the test runs the last row of data imported to the global sheet, it goes back up to the first row (or iteration) and cycles through the data again....This repeats forever. My script looks like this: DataTable.Import("C:\Documents and Settings\XXXXXXX\Data\My Documents\MaterialNumber.xls") Do Until DataTable("MaterialNumber") = "" ..... ....... .........SetCellData 1,"Material", DataTable("MaterialNumber", dtGlobalSheet) ............ .............. ................. .................... DataTable.SetNextRow Loop The "MaterialNumber" is not labeled, or parameterized in the global sheet, it doesn't exist until the xls is imported. Everything works fine except that the loop never ends. Perhaps my loop logic is the wrong way to go. I just want to be able to upload a list of data, have the test run through each row, then stop when it has tested all the rows. Any help is greatly appreciated. Thanks in advance!!!! Regards, Shawn |
| Sponsored Links |
|
|||
|
Re: DataTable Question
Hai friend,
select File->Settings-> Run->Run one iteration only Click on Apply Click on Ok Then run the test and let me know Thanks Deepa |
| The Following User Says Thank You to deepasree For This Useful Post: | ||
|
|||
|
Re: DataTable Question
I think it just doesn't ever recognize the "" as a blank row, because it only pulls in the rows that have data in the xls and none of those are blank. I'm going to try to add an "end" as the last row in my xls sheet. Then run the loop until the value = "end"
I think what you suggested will have helped though, because it doesn't re-import the xls every time now. |
|
|||
|
Re: DataTable Question
That did it. Thank you very much! Before I changed the "run one iteration" setting I guess it would go back the beginning of the test and re-import the data from the excel sheet and start the process over....
Do you know if there is way to get it to end the loop without having to input "end" at the end of the xls data and test for that? I'm not sure we'll want to have to add "end" at the bottom of every column of data that we test. Thanks again! |
|
|||
|
Re: DataTable Question
hai friend,
Adding end at the end of the column is not at all an apt approach Use the below code what I have suggested It will return the number of rows present in the datatable. Your run settings should be select File->Settings-> Run->Run one iteration only. It the datatable row is empty the loop will be automatically get terminated. Datatable.ImportSheet "C:\Documents and Settings\Deepa\Desktop\ABC.xls" For i=1 to Datatable.GetRowCount 'Msgbox Datatable.GetRowCount ' Returns number of rows present in the datatable 'your steps here Datatable.SetNextRow Next By using the above code without using "end" your loop will automatically end. Thanks Deepa Last edited by deepasree; 06-12-2009 at 02:17 AM. |
| The Following User Says Thank You to deepasree For This Useful Post: | ||
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| datatable.import | rajaputra | QTP | 3 | 06-27-2009 05:02 AM |
| values in datatable | thegoro | QTP | 4 | 06-01-2009 04:37 AM |
| How to set cursor on different datatable separately? | mkansakar | QTP | 1 | 04-27-2009 06:48 AM |
| Datatable and parameterization | newqtp | QTP | 1 | 04-11-2008 10:43 PM |
| Create datatable in memory | Geek_Guest | C# | 2 | 12-13-2007 01:08 AM |