Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Storing value from webtable in an array and comparing

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,59096
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Storing value from webtable in an array and comparing
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Storing value from webtable in an array and comparing - 4/14/2008 4:50:56 AM   
  anukulsinghal

 

Posts: 2
Score: 0
Joined: 4/14/2008
Status: offline
Hi,

Here is a problem that I am facing with the code snippet (attached below). The code stores values from the GetCellData method of WebTable and stores in an array. Now, when I want to compare that value (stored in the array) with a given value using an "If" statement, it never goes in the "If" loop. Can anyone please look at the code below and tell me the fault with it:

ColName = "Group"
Redim Col(14), Col_Num(14)

For i = 1 to 14
   Browser(....).Page(....).WebTable(....).GetCellData(1,i)
   msgbox Col(i)
   If Col(i) = ColName Then
       Col_Num(i) = i
       Exit For
   End If
Next

Now, msgbox Col(i) always gives the correct values (one of the values being "Group", which I need to match), but it never goes in to the "If" loop. It will simply show the result of the msgbox 14 times. Can anyone please help?

Thanks,
Anukul
 
 
Post #: 1
 
 RE: Storing value from webtable in an array and comparing - 4/14/2008 4:55:42 AM   
  dm_4ever


Posts: 2641
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
Is the "Group" that Col(i) displays in the proper case as your variable ColName?  Could Col(i) contain any blank spaces?

If you try

If UCase(Col(i)) = UCase(ColName) Then ... does this work?

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to anukulsinghal)
 
 
Post #: 2
 
 RE: Storing value from webtable in an array and comparing - 4/14/2008 5:02:39 AM   
  ebgreen


Posts: 4971
Score: 31
Joined: 7/12/2005
Status: offline
Also, try changing the MsgBox to:

MsgBox "COMPARING |" & Col(i)  & "| TO |" & ColName & "|"

to verify that there is no white space and that the values are indeed identical.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to anukulsinghal)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Storing value from webtable in an array and comparing Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts