the underline charaacter is real enough. Yes, it is a line continuation symbol.

----- Original Message ----- From: "David Helkenn" <[email protected]>
To: <[email protected]>
Sent: Thursday, March 01, 2012 4:49 AM
Subject: Re: Very Large Array Storage


Thank you, Bruce. It does help. Of particular interest is how 'r(1)' could refer to element in r(1)(1), when, being 0 based, and 1 refering to the second array should have displayed 100, i.e. r(1)(0) is 100. It seems ambiguous. The second set of parenthesis making the index into the second array is not ambiguous and makes matters much clearer.

What is also intrigueing is the '_' in what I think of as a line continuation spot, similar to theLinux '\'. Is this for real? Or, were you merely using that as a break character. I'm unaware of VBScript having a line continuation mark. I understand the ':' as a way to tell VBS to treat the two sides of the ':' as separate lines. but, I never knew of a line continuation mark!

Thanks again...

Dave


At 01:37 PM 2/29/2012, you wrote:

Hi Dave,

    I suspect there are many things you are looking into. Below is an
example of making arrays. Now in your script section you declare the
variables and assign them there. Now I suspect you want a dynamically loaded
array.
' Making an array of arrays:
ar = Array( Array(10, 11, 12, 13,14, 15), _
Array(100, 102, 104, 106, 108, 110))

Dim result: result = ar(1)
msgBox result(1)
Your display is: 102
msgBox ar(1)(2)
Your Display Is: 104

It takes the second array, because all VB arrays are 0 based and 1 was
selected to use and the first one wanted the second element for the same
reasoning, thus you get 102. The second one approaches it directly instead
of making a second assignment, it looks at the array inside the array, thus must use the second parens to get to it, because the first one is an array,
thus the second set of parens reflects it's properties.

    This is an example of declaring and setting.

    You can also set many arrays in the first dim and use those names and
make a second array like above and use each name of the first in the second. Now you can change the size at will by using the Redim as I stated below at any time. Noting that data elements of the array are lost if you shrink any
element of the array. Those not included are lost at that point.

So if you shrink your array loaded with arrays, then those arrays above
the redim statement will all be lost.

You can keep track of your arrays by number or by storing those numbers
in a dictionary and assigning a name to each number inside the dictionary.
This would allow you to keep track of all your arrays by name by associating
that name to a given number, or row of the array.

    I hope this helps.
        Bruce

Sent: Wednesday, February 29, 2012 12:09 AM
Subject: Re: Very Large Array Storage


Thank you, Bruce. I thought I would use the DynArray facility from
the toolkit since I know I have the 50 static entries in the first
dimension. If I were doing this in C, I would actually have the
elements of this dimension 50 array consist of pointers to integer
arrays, one at each index. I would build this array by locating the
index into the 50 static array and then append another integer onto
the end of the integer array pointed to by that entry. I thought I
could use the DynArray method 'add' to accomplish this.

The trouble is, I'm not doing pointers. I see no way of declaring the
first and static array which has a known size after all, of being an
array of dynamic array elements. I know the integers in each dynamic
array are sorted as I build the thing. I plan to use other variables
to track locations within the dynamic array of integers etc.

So, that is one problem, how to tell VBScript that the staticArray(5)
has a DynamicArray() which may have indexes from 0 to the method
'total' or 'count' (I forget what it is called exactly. In
programming languages, one usually has to specify the elements the
array contains. int *StaticArray[] comes to mind. The compiler
understands that the array StaticArray is of unknown length and
points to int; that is StaticArray is an array of pointers to int.
How does VBScript come to "understand" that in my case, StaticArray
is an array of known length, but that the elements of that array are
themselves, arrays of integers?

The second problem is how to store about 8500 integers? Again, I want
this to be a global script. Usually there is some sort of
initialization doen on an instance of an object. I can't remember the
term for it, but when the object is instantiated, there is an implied
initialization of that object before its properties and methods are
available. Even when the object is done with and destroyed, there is
some 'finalization" or clean up to take care of resource reclaimation etc.

So, if I could do the initialzation when this global script starts,
the integers would be there and the routines invoked at script
activation time would find the arrays ready for reading. By the way,
the integers are all read only. The user may not fiddle with the data
set in any way, except to read them. No writing allowed. If the
script is unloaded, the memory and any other overhead resources could
be reclaimed. I don't know how to do this sort of stuff.

Thanks for the help. This is certainly an interesting challenge for me!

Dave



At 01:17 PM 2/28/2012, you wrote:

>Hi Dave,
>
>     You first dim your array with just () or parens.
>     At any time you can add to or delete from the array using the redim
>statement.
>Now, to preserve existing data you use the word preserve. without that >word
>all data in your array is lost.
>
> Now the next thing is you can increase size or dimensions but can > not
> do
>the reverse. ReDim takes the last dimension and increases it, or adds
>another dimension on to it.
>     So you can erase the entire array by just given it a dim or redim
>command.
>Format:
>'In the app body or init section
>Dim YourArray()
>' Make an initial size of 40 with no data inside.
>ReDim YourArray(40)
>' When Inside sub or functions increase the size:
>ReDim Preserve YourArray(6000)
>' To Increase dimensions:
>ReDim Preserve YourArray(6000, 4)
>'Note:
>' Remember you can not go backward or any data in those dimensionns >or
>locations will be lost.
>'Such as
>ReDim Preserve YourArray( 6000, 2)
>'You have lost all data in the 3'rd and 4'th dimensions.
>ReDim Preserve YourArray(6000)
>'You lost all data in the second dimension.
>ReDim Preserve YourArray(40)
>'You are now down your original size and all data above that is lost.
>
>     I hope this helps. Any saving of data for future useage either put
> them
>in an iniFile or external file as mentioned by others.
>         Bruce
>
>Sent: Tuesday, February 28, 2012 12:22 PM
>Subject: RE: Very Large Array Storage
>
>
>Hello,
>Thanks for your reply. I'm not actually polling anything. I refered
>to the collection (not a technical term, just a set) of arrays to
>hold integers in an organized manner. They are more like mapping
>arrays and ordered integers. An anology would be an static array of
>of dynamic arrays like a list of variable length strings.
>
>Thanks...
>
>Dave
>
>
>At 07:56 AM 2/28/2012, you wrote:
> >What kind of database are you pulling from? Will you be using SQL to
> >perform
> >the retrieval?
> >
> >-----Original Message-----
> >From: David Helkenn [mailto:[email protected]]
> >Sent: Tuesday, February 28, 2012 8:55 AM
> >To: [email protected]
> >Cc: [email protected]
> >Subject: Very Large Array Storage
> >
> >Hello,
> >I want to write an app that will require a fairly large database
> >organized
> >in arrays. There are around 8500 integer elements to be stored in some > >35
> >arrays. I thought I could have a static array of the 35 dynamic arrays
> >containing the integers. However, I do not know how to get all that > >data > >initialized prior to the invokation of the rest of the app. How do I > >get
> >that data known to the app?
> >
> >The behavior from a very high view, is the user presses the activation
> >hotkey, the controls are displayed in the dialog and the database is
> >available for use. I do not know how long it will take to create the
> >database, but it is subject to an easily implemented algorithm.
> >
> >I am hoping to have this app as global. Will I need to use a file? If > >so,
> >where is the documentation related to the file system? I find only a
> >file/dir related document but there is no FSO in the GW toolkit. Help
> >please.
> >
> >Using Windows7pro64 and WE 7.5.3.
> >
> >Thanks...
> >
> >Dave


Reply via email to