Micro Focus QTP (UFT) Forums
Parameterize at different pace, and multiple write to Excel - 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: Parameterize at different pace, and multiple write to Excel (/Thread-Parameterize-at-different-pace-and-multiple-write-to-Excel)



Parameterize at different pace, and multiple write to Excel - joncfrazier - 07-10-2012

I've been trying for a week to get timer events to write to an excel file but have had 0 luck finding an answer that is clean and efficient.

There's a secondary issue here as well, in that my loops scripts loop indefinitely, even though they shouldn't (afaik)

What I am trying to do:
1) Search requires two fields: Location and Product
2) Each Product will be searched with each location (6 of each, 36 total)
3) Each search will be timed, with the results being written to an excel file.
4) Excel needs to have all 36 location + product + search time recorded


Code:
Do While viteration01 < 6
    If viteration01 > 6 Then Exit Do
        Browser("...").Page("...").WebEdit("...").Set "locA"
        Browser("...").Page("...").WebEdit("...").Set DataTable ("Prod", dtglobalsheet)
        Browser("...").Page("...").WebButton("Submit").Click
        vSC = Browser("...").Page("...").WebTable("...").GetCellData (2,1)
        vProd = Browser("...").Page("...").WebTable("...").GetCellData (2,2)
        'msgbox "SC = " & vSC &_
        'vblf & "Product = " & vProd
        
        viteration01 = DataTable.GlobalSheet.GetCurrentRow
    '    msgbox "Iteration #: " & viteration01 &_
        'vblf & "SC = " & "01" &_
        'vblf & "Parameter = " & DataTable.GlobalSheet.GetParameter ("Prod")
    DataTable.GlobalSheet.SetNextRow
    
Loop

Using that loop to go through all of the products for each location, as opposed to having a massive parameterization list. It works as far as exiting the loop and going to the next block, but at the end of the script it all restarts.

Secondly, I have tried using various scripts to write to an excel file, but I can't seem to get any to work. Even then I'm not sure how I can write the time event (which isn't added yet) to the next open row. So far it looks like it would only write to the designated cells?