Collapse (?) An Array?
admin at mfelkerco.com
Thu Sep 1 08:48:45 CDT 2011
I totally get what the OP wants, code-wise, I just cannot help make
it happen, but perhaps I can put it in my terms and help someone more
knowledgeable than me help him.
What he is saying, is that when a
variable is deleted from within the array, he needs the entire array
re-ordered (sorted) and moved up a notch to account for the now deleted
So, if A,B,C,D is the array with positions 1,2,3,4
delete array variable 2
It will now look like this:
array numbers are now:
He needs it to be
The C is now 2 and the D is now 3, so on and so forth across however
large the array is.
Now, does one simply re-write the array once the
deletion is made?
Note - if this is for a database and you
are dealing with IDs, then DO NOT RE-ORDER ANYTHING - you will break the
database (well, not literally until you do a SAVE - then you really will
break it). Just leave it as is. Databases can eventually be re-ordered
(re-indexed) once they are too large and riddled with holes, but until
then, just leave it alone.
On Thu, 1 Sep 2011 14:27:44 +0100,
Dave Cragg wrote:
> On 1 Sep 2011, at 14:16, Dave Cragg wrote:
It seems using any key on an existing array will produce an empty value.
(I don't know if that's how it should behave. I guess the alternative
would be throwing an error.)
> Update: it seems the array doesn't
even need to exist. This also produces the same result:
> put "A"
> put "B" into theArray
> put "C" into theArray
delete variable theArray
> put theArray &"*"&otherArray &"*"&
> use-livecode mailing
> use-livecode at lists.runrev.com 
> Please visit this url to
subscribe, unsubscribe and manage your subscription preferences:
 mailto:use-livecode at lists.runrev.com
More information about the use-livecode