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