Micro Focus QTP (UFT) Forums
String comparision using Data sheet:- inconsistant behaviour. - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: String comparision using Data sheet:- inconsistant behaviour. (/Thread-String-comparision-using-Data-sheet-inconsistant-behaviour)



String comparision using Data sheet:- inconsistant behaviour. - chetan-24 - 10-07-2008

hello all,
i have found some wired behaviour in qtp 9.2
i want to compare the images which are displayed in listbox.
i have applied following code.
The comparision working fine but sometime the imagename and the name entered in datasheet both are exactly same evenif i have printed them using message box but it cann't work.

I have no any idea how its possible.

Please look at my code and let me know i am going to right way or not ?
let me know if anyother logic can work here
The code is as follows:


Code:
public Function imageSelection()
Dim i
i = Browser("Certificate Error: Navigation").Page("Ion Ad Manager on QAS1_8").WebList("assocImg").GetROProperty("items count")

image1 = trim(DataTable("Img1", dtGlobalSheet))
image2 = trim(DataTable("Img2", dtGlobalSheet))
image3 = trim (DataTable("Img3", dtGlobalSheet))
image4 = trim(DataTable("Img4", dtGlobalSheet))
image5 = trim(DataTable("Img5", dtGlobalSheet))

For counter = 1 to i
j = trim(browser("Certificate Error: Navigation").Page("Ion Ad Manager on QAS1_8").WebList("assocImg").GetItem(counter))
    If strcomp( image1,j,1)=0 Then
    msgbox "Image-1 Pass"
    wait(5)
    Browser("Certificate Error: Navigation").Page("Ion Ad Manager on QAS1_8").WebList("assocImg").ExtendSelect(image1)
        msgbox "First Image is selected successfully" & image1
    end if

    If strcomp(image2,j,1)=0 Then
    Browser("Certificate Error: Navigation").Page("Ion Ad Manager on QAS1_8").WebList("assocImg").ExtendSelect(image2)
     msgbox "Second  Image is selected successfully" & image2
          End If

    If strcomp(image3,j,1)=0 Then
    'Browser("Certificate Error: Navigation").Page("Ion Ad Manager on QAS1_8").WebList("assocImg").ExtendSelect(image3)
    End If

    If strcomp(image4,j,1)=0  Then
Browser("Certificate Error: Navigation").Page("Ion Ad Manager on QAS1_8").WebList("assocImg").ExtendSelect(image4)
    'End If
        
   If strcomp(j,image5,1)=0  Then
Browser("Certificate Error: Navigation").Page("Ion Ad Manager on QAS1_8").WebList("assocImg").ExtendSelect(image5)
        wait(5)
End If
next
End Function

Waiting for Reply
Chetan