Micro Focus QTP (UFT) Forums
Table check point for comparing data of 2 tables - 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 Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others)
+--- Thread: Table check point for comparing data of 2 tables (/Thread-Table-check-point-for-comparing-data-of-2-tables)



Table check point for comparing data of 2 tables - ritugoyal - 02-05-2010

Hi All,

Please help me!
In 2 variables, I am storing storing 'WebTables' by calling some reusable actions. Now I want to implement tables check points and want to compare that data of both the tables is same.

I am struck in this scenario, Please help me to implement table check points on tables variables and compare data.

Regards,
Ritu
waiting for answer!!Smile

Thanks


RE: Table check point for comparing data of 2 tables - rameshrise3 - 02-06-2010

Hi,
Stand Checkpoint on Webtable can be implemented but with this, you cant compare values between 2 tables,

for your scenario, get all the required cell values from both tables and compare them

Ex:
Code:
For
Table1value = Browser("...").Page("...").WebTable("Table1").GetCellData(i, j)
Table2value = Browser("...").Page("...").WebTable("Table2").GetCellData(i, j)
if Trim(Table1value) = Trim(Table2value) Then[hr]
Please find the full code below,

Rcnt1 = Browser("...").Page("...").WebTable("Table1").Rowcount
Rcnt2 = Browser("...").Page("...").WebTable("Table2").Rowcount
For i = 2 to Rcnt1
    for j= 2 to Rcnt2
        Table1value = Browser("...").Page("...").WebTable("Table1").GetCellData(i, j)
        Table2value = Browser("...").Page("...").WebTable("Table2").GetCellData(i, j)
        if Trim(Table1value) = Trim(Table2value) Then
            Reporter.Reportevent 0, "Values Check", ".................."
        Else

            Reporter.Reportevent 1, "Values Check", ".................."
        End If
    Next
Next