I have a list box which contains duplicate values e.g.
A,A,A,B,B,B,C,C,C.Now write a code in qtp to test the list
box .
Scenario #1 : I have to check whether any values are there?
Scenario #2 : If duplicate values are there,then how many
time it is getting duplicated?
Svenario #3 : how can I test presence of items in list box
ommiting duplicate values?

Answer Posted / bhargavi

A small change is required in the logic.

arr=array(1,2,4,1,2,6)
cnt=0
For i=0 to ubound(arr)
For j=i to ubound(arr) <-- Not j=0 but take j=i so that comparison will not be repeated
If i<>j Then
If arr(i)=arr(j) then
print arr(i)&"is repeated"
End if
End If
Next
Next

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to check which add-ins are associated with a test in qtp?

582


Is there any pdf or online book for QTP Scripting? Let me know more about QTP Scripting.

2427


If the objects hierarchy is changing from build to build, then how you will handle that condition?

619


what type of run time errors you get while you ar edoing rpg program?

1513


Explain the types of object repositorys in qtp?

576






Is it possible to split an action? How?

660


Explain the new feature of UFT regarding the export of test results?

578


What is a checkpoint? How many check points are there in qtp?

530


Explain actions in qtp ?

556


images are dynamically changes how to compare two images with out using the bitmap

2005


What is recovery scenario in qtp?

583


Can any suggest me what is exposure testing?

1376


Explain about the test fusion report of quicktest professional (qtp)?

537


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

2852


For the below written code , i want to be stop the loop (ex:10 times), but it is focusing to first line of the code & generating error. vbwindow("vbname:=frmMain").Type micAltDwn + "6" + "2" + "D" +micAltUp 'wiil open the particular window in application vbwindow("vbname:=frmDeduction").vbbutton("vbname:=cmdNew").Click DataTable.ImportSheet"F:\QTP VBScript\Form 26-1.xls","Deduction",Global RowCount = DataTable.GetSheet("Global").GetRowCount i=RowCount For j =1 to i 'vbwindow("vbname:=frmDeduction").WinObject("nativeclass:=DataComboWndClass","abs_y:= 187").Type DataTable("Name", dtGlobalSheet) vbwindow("vbname:=frmDeduction").ActiveX("acx_name:=DataCombo","abs_y:= 187").Type DataTable("Name", dtGlobalSheet) vbwindow("vbname:=frmDeduction").ActiveX("acx_name:=DataCombo","abs_y:= 187").Type micF4 vbwindow("vbname:=frmDeduction").ActiveX("acx_name:=DataCombo","abs_y:= 187").Type micTab vbwindow("vbname:=frmDeduction").ActiveX("acx_name:=DataCombo","abs_y:= 216").Type micF4 vbwindow("vbname:=frmDeduction").ActiveX("acx_name:=DataCombo","abs_y:= 216").Type DataTable("Section", dtGlobalSheet) vbwindow("vbname:=frmDeduction").ActiveX("acx_name:=DataCombo","abs_y:= 216").Type micTab vbwindow("vbname:=frmDeduction").VbEdit("vbname:=txtAmtOfPay").Set DataTable("Amount_of_Payment", dtGlobalSheet) vbwindow("vbname:=frmDeduction").VbEdit("vbname:=txtAmtPaidDate").Set DataTable("Amount_PaidCredited_Date", dtGlobalSheet) vbwindow("vbname:=frmDeduction").VbEdit("vbname:=txtAmtPaidDate").Type micTab vbwindow("vbname:=frmDeduction").ActiveX("acx_name:=DataCombo","abs_y:= 316").Type micF4 vbwindow("vbname:=frmDeduction").ActiveX("acx_name:=DataCombo","abs_y:= 316").Type DataTable("Deduction_is", dtGlobalSheet) vbwindow("vbname:=frmDeduction").ActiveX("acx_name:=DataCombo","abs_y:= 316").Type micTab vbwindow("vbname:=frmDeduction").VbButton("vbname:=cmdSave").Click DataTable.SetNextRow Next vbwindow("vbname:=frmDeduction").VbButton("vbname:=cmdClose").Click

2640