Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Dynamic Array problems...

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Dynamic Array problems...
  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 >>
 Dynamic Array problems... - 6/20/2007 5:16:41 AM   
  webren


Posts: 16
Score: 0
Joined: 5/17/2007
From: College Park, MD
Status: offline
Hello,
I constantly get a Type Mismatch runtime error at line 60 (when trying to initialize linkInfoArray).  If I comment out that line and never declare linkInfoArray, the problem goes away but the application is perfoming incorrectly.  Technically, I don't need a dynamic array as I know there will always be four elements added to the array, but elements will constantly be added as everything is iterated.  This is why I use the Erase command on line 67 to erase the contents of the array, so that the next time information gets added into the array, there will be no elements present.  Also, it seems like Erase can only be used for dynamic arrays.  Am I using the array constructs appropriately?  Code:

      

What the application does is obtain keywords from a database table and then view a paragraph (which will also be obtained from the database at another time in coding development) to see if that keyword is present in the paragraph.  If the keyword is present, it will obtain linking information from the database table and make a link out of the keyword (with the remaining of the paragraph being the same).

Thanks for any help!
 
 
Post #: 1
 
 RE: Dynamic Array problems... - 6/20/2007 6:28:18 AM   
  Skie

 

Posts: 58
Score: 0
Joined: 3/2/2006
Status: offline
The reason your array failes is this line:
             linkInfoArray = objDictionary.Item(keyword)
You change the variable from an array to a query.  So once you try to access it as an array it fails.  You should enumerate the items in the query to set str1, str2, str3, and str4.  It may just be a string, you could try a MsgBox linkInfoArray after that line.

< Message edited by Skie -- 6/20/2007 6:30:29 AM >

(in reply to webren)
 
 
Post #: 2
 
 RE: Dynamic Array problems... - 6/20/2007 6:41:46 AM   
  webren


Posts: 16
Score: 0
Joined: 5/17/2007
From: College Park, MD
Status: offline
Skie,
   The array nevers get changed to a query as the getArticlesKeyword() function will return an array of results from the query.  I am also not sure what you mean by enumerating the items.

(in reply to Skie)
 
 
Post #: 3
 
 RE: Dynamic Array problems... - 6/20/2007 7:06:23 AM   
  webren


Posts: 16
Score: 0
Joined: 5/17/2007
From: College Park, MD
Status: offline
I solved my problem by using the array by commenting out the line that ReDimensions it and commenting the line that delcares it (like I mentioned previously).  I am still curious as why VBScript gave me that error when ReDimensioning it and such.  Thanks for your thoughts, Skie, and to anyone else that took a look at this thread.

(in reply to webren)
 
 
Post #: 4
 
 RE: Dynamic Array problems... - 6/21/2007 8:13:32 AM   
  Skie

 

Posts: 58
Score: 0
Joined: 3/2/2006
Status: offline
What format is the array of the query?  I ran some simple tests for returning an array from a function.

This works

      

This fails

      

This fails

      

This works

      

This works

      

This fails

      

(in reply to webren)
 
 
Post #: 5
 
 
 
  

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 >> Dynamic Array problems... 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