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?



In a Web appl, on a page, there are student names & details listed.On clicking sort button,det..

Answer / 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

More QTP Interview Questions

what is difference between wait and synchronization point.

3 Answers   IBM, Intel,


It is a SQL question. Write a query to find top three salaries in an EMP TABLE?

7 Answers  


GET WHETHER THE GIVE NUMBER VALID OR NOT IN BETWEEN THE GIVEN RANGE?IN VB SCRIPT(QTP)

2 Answers   CSC,


WHAT IS THE FRAMEWORK & ARCHITECTURE OF YOUR PROJECT

3 Answers   Wipro,


Have you ever written a compiled module? If yes tell me about some of the functions that you wrote.

1 Answers  


How to maintain the old scripts in QTP?

2 Answers   Olive Tech, Wipro,


What is obsolute path and relative path in QTP..? How to access them and what are the differences between them...??

3 Answers   Virtusa,


What is vulnerability?

1 Answers   CTS,


How to capture all the data of a webtable, weblist and combolist using QTP?

0 Answers   ITC Infotech,


Explain about opening notepad in QTP and writing of test result in notepad?

4 Answers  


Hi,iam new to automation and i have 1 year experience in manual testing.I have a little bit idea about QTP9.0 .But i have no idea about script writing using VB.Please help to learn script writing.

1 Answers  


wht is the difference betn check point and output value?

5 Answers   BirlaSoft,


Categories