Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Comapring two List & Print the missed values
#1
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi All,

Code:
Call compare_values()

Function compare_values()

   Exp_Values="India,Spain,Japan,Singapore,Russia,China,Mexico,England,Germany"
    Spl_Exp_Values=split(Exp_values,",")

    Act_values="India;Japan;Singapore;China;England"
    Spl_Act_values=split(Act_values,";")

        For i=0 to Ubound(Spl_Exp_values)
        flg=0

            For j=0 to Ubound(Spl_Act_values)
                comp=Strcomp(Spl_Exp_Values(i),Spl_Act_values(j))
                If comp= 0 Then
                    flg=flg+1
                    Exit For
                End If
            Next

        If flg=0 Then
                Print (Spl_Exp_Values(i) & " not found in Actual Values list")
        End If

    Next

End Function

In above function I am comparing two List (i.e :-Exp_vaues,Act_values). Then I would like to print the missed values in second list which is present in first. Now I'm getiing Output like below,

Output:-
Spain not found in Actual Values list
Russia not found in Actual Values list
Mexico not found in Actual Values list
Germany not found in Actual Values list

But I would like to print all the missed values in one statement(E.g:-Spain,Russia,Mexico,Germany not found in Actual values list)

Pls help me to get solution for this.


Attached Files Image(s)
   
Reply
#2
Solved: 11 Years, 3 Months, 4 Weeks ago
Modify this code as

Code:
If flg=0 Then
                Print (Spl_Exp_Values(i) & " not found in Actual Values list")
        End If
dim str1
str1=str1&Spl_Exp_Values(i)
come out of loop and print the str1 value
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to print value in QTP Log using .vbs kalyaniR 1 3,375 10-25-2013, 04:32 PM
Last Post: ssvali
  Values present inside a dropdown list. prempujaripati 1 2,918 03-05-2013, 12:20 PM
Last Post: basanth27
  QTP 9.2 Checking values in a dropdown list Poonam 5 21,135 11-29-2011, 04:40 PM
Last Post: vibhakhandelwal
  how to validate combobox values with testdata values 1981.madhu@gmail.com 3 6,005 09-09-2009, 06:53 PM
Last Post: Saket
  Checking if values of Listbox/Combo box on a web page the same with values in DB? robocom 4 8,399 07-08-2009, 01:52 PM
Last Post: robocom

Forum Jump:


Users browsing this thread: 1 Guest(s)