Re: Playing with multidimensional array!?

Tech-Archive recommends: Fix windows errors by optimizing your registry



"Claude Lachapelle" <ClaudeLachapelle@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:6F901599-03E5-4C95-BD8E-BAC64FE14AE2@xxxxxxxxxxxxxxxx
Hi!

I need to play with a multidimensional array in VBScript, but I`m about to
turn crazy with the way they are implemented into VBScript!

I need to start with an empty array, and start filling it with two
dimension
data like:

Row 1, Column 1 = mailbox.LegacyDN
Row 1, Column 2 = mailbox.ServerName
Row 1, Column 3 = mailbox.LastLogonTime
Row 1, Column 4 = mailbox.Size

Row 2, Column 1 = mailbox.LegacyDN
Row 2, Column 2 = mailbox.ServerName
Row 2, Column 3 = mailbox.LastLogonTime
Row 2, Column 4 = mailbox.Size

and so on... and after gathering all mailboxes informations on all
Exchange
Servers, I will be able to match Active Directory Users by seeking this
table
for the
corresponding ExchangeLegacyDN.

Actually, I'm defining the array with Dim aMailboxes(), and adding data to
it by using the REDIM PRESERVE, but where I'm really confused, it is how
the
REDIM the two dimension and after that, assigning values to the new Row
added... someone expert or familiar with that could help me?

You can only ReDim the last dimension (in your case "Rows");
thus, your array may look like:

Dim aMailboxes()
ReDim aMailboxes(3,0)
'* aMailboxes(0,#) = mailbox.LegacyDN
'* aMailboxes(1,#) = mailbox.ServerName
'* aMailboxes(2,#) = mailbox.LastLogonTime
'* aMailboxes(3,#) = mailbox.Size
Dim iMailboxes
iMailboxes = 0

ReDim Preserve aMailboxes(UBound(aMailboxes,1),iMailboxes)
aMailboxes(0,iMailboxes) = LegacyDN...
aMailboxes(1,iMailboxes) = ServerName...
aMailboxes(2,iMailboxes) = LastLogonTime...
aMailboxes(3,iMailboxes) = Size...
iMailboxes = iMailboxes + 1



.



Relevant Pages

  • Re: Playing with multidimensional array!?
    ... I need to play with a multidimensional array in VBScript, ... You can only ReDim the last dimension; ... Dim iMailboxes ... ReDim Preserve aMailboxes,iMailboxes) ...
    (microsoft.public.scripting.vbscript)
  • How to create a "Array of Bytes" in VBScript?
    ... I need to create an "array of bytes" in VBScript. ... redim preserve Test5 ... Prev by Date: ...
    (microsoft.public.scripting.vbscript)
  • Re: User Define Array Data Type - Subscript out of range
    ... ReDim Preserve xArray.IntInputOrder ... ' Load Array ... strDataTypeAs String ... Dim rs As ADODB.Recordset ...
    (microsoft.public.access.modulesdaovba)
  • Re: What does Redim Preserve do in term of memory
    ... I believe Redim Preserve creates a new array with the specified bounds and ... then does an element-by-element copy from the old array to the new array, ... Dim AllocatedToBound As Long ... Dim Ndx As Long ...
    (microsoft.public.excel.programming)
  • Re: VBscript Array Split Function
    ... inputted into an array so that each separate character in the array is ... make sense and can't be handled properly by VBScript. ... Dim strValue, strChar, k, arrChars() ...
    (microsoft.public.scripting.vbscript)