Micro Focus QTP (UFT) Forums
Check for sorting functionality through QTP - 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: Check for sorting functionality through QTP (/Thread-Check-for-sorting-functionality-through-QTP)



Check for sorting functionality through QTP - dol_fin - 07-19-2012

Hello,


I am stuck on one issue. I need to know how to check that the table has been sorted after clicking on the header link.

The page has 5 tables on it and i want qtp to be able to click the header, and check to see if that table has been sorted.

I have attached an image

Please help.


RE: Check for sorting functionality through QTP - sshukla12 - 07-19-2012

Hi,

Spy on the header and try to identify what object it is. If it is clikable then perform the click operation on it and verify the result.

Let me know in case of any help required.

Regards,
Sankalp


RE: Check for sorting functionality through QTP - dol_fin - 07-19-2012

Yes, i can identify the object but that doesnt really help with the sorting. I need to be able to check when after clicking the header, whether or not the table is sorting the data.


RE: Check for sorting functionality through QTP - sree.85 - 07-20-2012

load the data of the column that you want to check the column(sort data) into the datatable global sheet and then compare the values row1 with row2 and row2 with row3 and so on


Code:
dim x,i,k,flag
flag=false
k=1
rowcount=datatable.rowcount

for i=1 to rowcount  
datatable.setcurrentrow i
x=datatable.value("column header",dtglobalsheet)
if x>k then
k=x
flag=true
else
msgbox "your result is fail"
exit for
end if
next

if flag=true then
msgbox "the data is sorted"