Re: Data From CREATEOBJECT



Hi Jeff,

For the record, I ended up using a two dimensional array with the object in the first column and the "key" in the second. The array is public (not my favorite way of doing things) so that all of the objects can find it and the main program can find all of the objects.

Why do you use the second column? I think, the object already has a property that stores the key. So there is no need to store it once more in the array.

> The solution is not elegant. There is data in the objects that must be
> preserved when the application isn't running so it is stored in a table
> (that's what databases are for, I think). The elegant solution would be a
> way to store the object pointer in the table when the application is running
> but from that various replies, I guess that isn't really doable. The array
> is working fine, however.

The object pointer is absolutely useless from the moment, when the application ends. At the next run, the object must be newly created and it is quite sure, that its location is very different from the former run of the application. The object is created with the property values from class definition, and these value are most likely different from the values of the former run of the application.

To save and restore the necessary properties just add two methods to your object, one for saving, one for restoring. Good places for calling these methods: in LOAD or INIT of the object call the restore method, in DESTROY or UNLOAD call the save method.
It depends on your needs how to store the values: if there is a fixed scheme which properties to store, you could use a table field for every property. If it is a variable set of properties, then it might be better to build a long string of the property names and the respective values and store this string in a memo field. XML would be a very modern choice for this string.

Regards
Bernhard Sander
.



Relevant Pages

  • Problems with Map.size()..........
    ... with first column of string type and the others columns of double type. ... array of double. ... //System.out.println("Il numero di colonne del file ...
    (comp.lang.java.programmer)
  • Re: Proper modularization technique
    ... will generate a string to be used by the calling routine. ... Should I set aside an array in the calling routine and have the ... the function might need to store more characters than the array ...
    (comp.lang.c)
  • Re: Using a 2 dimensional string array variable like a lookup function
    ... Dim Arr() As String ... destination path in the "second column" of the array. ... each element of the "first column" of the array, ...
    (microsoft.public.excel.programming)
  • Re: Using a 2 dimensional string array variable like a lookup function
    ... Dim Arr() As String ... Dim LookupTerm As String ... How would I use a 2 dimensional string array like a vlookup/hlookup? ... searched for this term) in the "first column" and the corresponding ...
    (microsoft.public.excel.programming)
  • Re: what is the best datatype for..
    ... If you are only going to store it, then use a string. ... each value in the array, check to see if it already exists in the ... If it does, then just increment the count, otherwise, add ...
    (microsoft.public.dotnet.languages.csharp)