Scripts for Ascending order in qtp.

Answers were Sorted based on User's Feedback



Scripts for Ascending order in qtp...

Answer / mahesh.k

a=array(1,5,6,3,10)
For i=0 to 4
For j=0 to 4
If a(i)<a(j) Then
t=a(i)
a(i)=a(j)
a(j)=t
End If

Next

Next
For i=0 to 4
print a(i)

Next

Is This Answer Correct ?    18 Yes 8 No

Scripts for Ascending order in qtp...

Answer / ekapop techawanto (scnyl)

The best way I found in case of your data sorting consists
of character and number, you may use Excel feature to
support this as following on:

'+++++++++++++++++++
Public Sub SCNYL_SortDataTest()
Const xlAscending = 1 'represents the sorting type 1 for
Ascending 2 for Desc
Const xlGuess = 0
Const xlTopToBottom = 1
Const xlSortNormal = 0
Const iCOLIDX_VALUE = 1 ' Set to Column "A"
Dim oExcel
Dim oWB
Dim oSheet
Dim oRange
Dim asInfo
Dim lRowIdx
Dim lMaxRows
Dim sColName

' Sample data
sValue = "eowos,bweoww, weoeos,ewsow,acc,bzaow,ceoes,
jaow, wwwowam, waosw, 1124,wowasdd, 56, 32,62,108"

' Classified to Array collection
asInfo = Split(sValue, ",")

' Refered to Excel Object
Set oExcel = CreateObject("Excel.Application")

' To make sure Excel Application already installed
If oExcel Is Nothing Then
' Clean Array Object
Erase asInfo
Exit Sub
End If

' Added a new the Workbook object
Set oWB = oExcel.Workbooks.Add

' Ignored all message window displays
oExcel.DisplayAlerts = False

Set oSheet = oWB.Worksheets(1)

' Get the Maximum of Array Object Boundary
lMaxRows = UBound(asInfo)
For lRowIdx = 0 To lMaxRows
' Loaded your data to Excel Sheet
oSheet.Cells(lRowIdx + 1, iCOLIDX_VALUE).Value =
Trim(asInfo(lRowIdx))
Next

' Set Excel Colum at "A"
sColName = "A1:A" & (lMaxRows+1)
oSheet.Range(sColName).Sort oSheet.Range("A1"),
xlAscending, , , , , , xlGuess, 1, False, xlTopToBottom, ,
xlSortNormal

' Clean Array Object
Erase asInfo

' If you'd like to array collection, you should
uncomment for the Array operation.
'ReDim Preserve asInfo(lMaxRows)
For lRowIdx = 0 To lMaxRows
With oSheet
'asInfo(lRowIdx) = .Cells(lRowIdx + 1,
iCOLIDX_VALUE).Value
Print .Cells(lRowIdx + 1,
iCOLIDX_VALUE).Value
End With
Next

' Not Save any thing for this Excel
With oWB
.Saved = False
.Close
End With
oExcel.Quit

' Restore memory allocation
Set oRange = Nothing
Set oWB = Nothing
Set oExcel = Nothing
'Erase asInfo
End Sub

'//// Main ////
Call SCNYL_SortDataTest()

Is This Answer Correct ?    6 Yes 0 No

Scripts for Ascending order in qtp...

Answer / vikas choubey

for i = UBound(appArray) - 1 To 0 Step -1
for j= 0 to i
if appArray(j)>appArray(j+1) then
temp=appArray(j+1)
appArray(j+1)=appArray(j)
appArray(j)=temp
end if
next
next

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More QTP Interview Questions

what is the another name for blackbox testing?

7 Answers  


What is qtpro?

0 Answers  


what are the drawbacks for record and payback in qtp

3 Answers  


If our application contain one image while executing script application failed to show that image but you have to check that image by importing dynamically from other location... Can we use Check Points here on dynamically imported image?

2 Answers   ADP,


Explain quicktest professional (qtp) testing process?

0 Answers  






1...HOW MANY TYPES OF OBJECT REPOSITORY ARE THERE IN QTP? 2....WHAT ARE THE REPOSITORY FEATURES EXPLAN. 3...HOW TO CREATE A RECOVERY SCENARIO? WHAT DOES RECOVERY SCENARIO MANAGER DO? 4...OPEN A WORD FILE AND MODIFIED WITH SOME VALUE USING QTP? 5... HOW TO CREATE EXCEL FILE USING QTP? 6... HOW TO RETRIEVE A VALUE FROM WEB TABLE? 7... WHAT IS QC REQUIREMENT TAB DO ? HOW TO MAP THE REQUIREMENT? 8... HOW TO PASS A VALUE FROM EXCEL FILE TO SCRIPT? 9...WHAT IS THE USE OF SPLIT FUNCTION?

1 Answers   RBS,


How reliable are the site's Internet connections required to be? And how does that affect backup system or redundant connection requirements and testing?

0 Answers  


How to apporach while starting the automation testing?

3 Answers   Patni,


suppose we recording a web based project so for that we are using internet explorer after that if we execute that script in netscape then script will execute or not and one more thing is to exeute the script in any browser what to do

2 Answers   DigiTech,


1)What is the Difference Between WaitTo & Sync?

4 Answers   Wipro,


what is the advantages and disadvantages of using functions instead of re usable actions

0 Answers  


iam working in QTP for 2+ of exp if i attend the interview what r questions asked in perfomence testing{loadrunner} ? pls any one can say answer to this question?

0 Answers   Infosys,


Categories