Micro Focus QTP (UFT) Forums
Compare Fields in DataTable for Checkpoint - 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: Compare Fields in DataTable for Checkpoint (/Thread-Compare-Fields-in-DataTable-for-Checkpoint)



Compare Fields in DataTable for Checkpoint - Brian.Osborne - 01-26-2011

Hello all. I'm new to the board but been working on QTP for a while. Self taught for the most part.
I need to compare 2 caputured values on the Global DataTable and give a pass/fail checkpoint.
Can anyone help with this?


Brian
Figured it out...
Code:
If DataTable("A", dtGlobalSheet) = DataTable("B", dtGlobalSheet) Then
    Reporter.ReportEvent micPass,"Compare A and B in DataTable", "Passed"
Else
    Reporter.ReportEvent micFail,"Compare A and B in DataTable", "Failed"
End If



RE: Compare Fields in DataTable for Checkpoint - Tarik Sheth - 01-27-2011

Hi,
Suggestion:


How about storing the values in Variable and then compare. I think it is a good practice instead directly comparing it from the Datatable. This will also help you if you want to format or discrd anything that you want from DataTable.

Something like in DataTable you have 80.00 and you just want to compare 80 so you can use temp=Split(Var,".")(0)