[Data Grid] Duplicate large amount of rows

zryip theSlug zryip.theslug at gmail.com
Fri Apr 30 14:04:07 EDT 2010

2010/4/30 Bob Sneidar <bobs at twft.com>:
> I would be careful with using arrays this way. I seem to recall in the command reference that combining an array will delete duplicate keys. As long as your keys are all unique you should be safe, but I would check the command reference for the join function you are using.
> I quote:
>> Comments:
>> The union command combines the array and testArray. Each key of the array is checked to see whether there is already an element with that key in the testArray. If there is, that element of the array is unchanged. If not, the corresponding element of the testArray is placed in the array.
> So you see, this does not exactly add all the records of one array to another. It depends on the keys in both arrays being globally unique.
> Bob

Thanks Bob for pointing this out. I confess I have not seen this specificity.
By chance, I have anticipated this. I have do things to be able to
select the new duplicated rows after the duplication.

In this goal, my code is structured like this:

1) Read the last index in the dgData
2) Create the first duplicated line with the last index of the dgData + 1
3) Repeat with the lines to duplicated. Set it the last index in the
duplicated rows + 1
4) Merge the two arrays
5) Change the dgData of the Data Grid

All my rows seems to be correctly created.

However the Data Grid command "AddData" does more than a simple
creation of a new index in an array. This is where I'm suspicious with
my code.


-Zryip TheSlug- wish you the best! 8)

More information about the Use-livecode mailing list