Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

In a Web appl, on a page, there are student names & details
listed.On clicking sort button,details are sorted on
Names.How do u verify htat sorting is done by using QTP?

Answer Posted / ankur_jain

you can use this function for comparing the values and if
your records are shown in webtable then you can use code
like this
in blank spaces between " " you have to pass your own
names
set hp=browser(" ").page(" ")
rc=browser(" ").page(" ").webtable(" ").rowcount
For i=2 to rc step 1
If i=rc Then
sone=hp.webtable(" ").getcelldata(i,1)
stwo=hp.webtable("html id:=dgList").getcelldata(i,1)
end if
sone=hp.webtable(" ").getcelldata(i,1)
stwo=hp.webtable(" ").getcelldata(i+1,1)
ret= CompareValues(sone, stwo)
'then on the basis of ret value you can verify that
list is sorted or not

'Using this function you can compare two values.
'Return values are based on three data types -Date,Numeric
or Text
'Return 1 if value1>value2 OR -1 if value1<value2, 0 if
value1=value2

Function CompareValues(sOne, sTwo) '--- as variant
On Error Resume Next

Dim im1,im2, iRtrn

if (isNumeric(Trim(sOne)) AND isNumeric(Trim(sTwo)))
then
im1 = CDbl(Trim(sOne))
im2 = CDbl(Trim(sTwo))
else
if (isDate(Trim(sOne)) AND isDate(Trim(sTwo))) then
im1 = CDate(Trim(sOne))
im2 = CDate(Trim(sTwo))
else
im1 = Trim(CSTR(sOne))
im2 = Trim(CSTR(sTwo))
end if
end if

iRtrn=0
If im1 < im2 then
iRtrn = -1
else
if im1 > im2 then
iRtrn = 1
end if
end if
CompareValues = iRtrn

If Err.Number > 0 then
strErrorMsg = "Error occured in function
CompareValues "
strErrorMsg = strErrorMsg & "Parameter
values passed to the function are: - ( " & sOne & ", " &
sTwo & ")"
Call ErrorHandler(strErrorMsg)
End If

End Function

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain different recording modes?

970


By using QTP can we record any log files written by the application which is in execution?

1884


X flies from Hyd to bangalore using different methods of transportation. write the test scenarios and test cases for this?

1981


Give me some real time point of way where exactly we can conduct audits?

1865


terminal services client

2188


How to make qtp understand the difference amongst the same type of objects .suppose there are 5 check boxes in a page and I have to choose the 2nd one, how to do that through script?

914


what the difference between shared repository and per action repository?

994


What is recovery scenario manager? When you go for recovery scenario manager?

994


Explain in brief about the quicktest professional automation object model?

892


can i change the runtime properties of an object ? How can i check if a parameter exists in database ?

1920


Through array we can execute the testcase how ? give me example

1815


How the exception handling can be done using quicktest professional?

951


Hi, I'm a beginner in QTP and planning of a certification in QTP, but have no idea about it :P. Could anyone please tell me what certifications that a QTP- beginner can take? What is the fees and the syllabus for the certification? Please reply soon. Thanks Vidhya

1816


How do you handle multiple banners(at the top the page, the banner is scrolling) in a web page(Dont take the name property(regular expression))

2070


What is action split and the purpose of using this in qtp?

968