Micro Focus QTP (UFT) Forums
Keep data through multiple 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: Keep data through multiple iterations (/Thread-Keep-data-through-multiple-iterations)



Keep data through multiple iterations - Brian.Osborne - 05-21-2011

Here is what I have.
I have a script in QTP that runs on a datatable of anywhere from 5 to 100 iterations. At the begining of the script a question is posed to the user. I want the answer to this question to be carried and used on all instances of the script.
Here is the code.
Code:
If Environment("ActionIteration") =1 and Environment("TestIteration") =1 Then
    intAnswer = _
    Msgbox("Would you like to test ****** while running this script?", _
        vbYesNo, "Test while running?")
    If intAnswer = vbYes Then
        TestEm = "Y"
    Else
        TestEm = "N"
    End If
End If
I'd like to have the TestEm value keep for every iteration. How do you do this?

Brian


RE: Keep data through multiple iterations - Brian.Osborne - 05-24-2011

No ideas on this? or am I asking the question in the wrong place?


RE: Keep data through multiple iterations - Tarik Sheth - 05-25-2011

Hi,

What is the question?
And what is the TestEm?

Can you please elaborate more?


RE: Keep data through multiple iterations - Anand - 05-25-2011

Create a Dynamic array with the help of Redim with preserve for the variable TestEm in the loop
Exp :
for i = 1 to 100 then
Redim TestEm(i) preserve ....


RE: Keep data through multiple iterations - Brian.Osborne - 05-27-2011

I was able to get around this by writing the captured value to an excel sheet on the first iteration only. Then referring to that value with each iteration after.