Micro Focus QTP (UFT) Forums
How to stop getting values from DataTable after the result passed? - 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: How to stop getting values from DataTable after the result passed? (/Thread-How-to-stop-getting-values-from-DataTable-after-the-result-passed)



How to stop getting values from DataTable after the result passed? - Uma - 10-13-2011

Hi
I am getting values from Data table and using that values I am asserting.I want to Quit the for loop iteration after it get the correct reply code.
This is my code.
Code:
fr=DataTable.LocalSheet.GetRowCount
'Print fr
For i = 1 to fr
DataTable.SetCurrentRow(i)
print i
rc=DataTable.Value("oRc",3)
print rc
If Browser("").Page("").WebElement("innerhtml:="&rc,"html tag:=B","index:=0").Exist(1) Then
'reporter.ReportEvent micPass,"Test got result:"&rc,"Test Passed"
End If
Next

Thanks for your time.
Thank you
Uma


RE: How to stop getting values from DataTable after the result passed? - vIns - 10-13-2011

Hi Uma,

Exit For ' it will take out of the for loop.

if ...... Then
Exit For ' when a condition is met, we quit the for loop
End if


RE: How to stop getting values from DataTable after the result passed? - Uma - 10-13-2011

Hi VIns,
it is working.
Thank You,
Uma