Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding a column to an array
Message
De
30/12/2003 11:05:11
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
30/12/2003 10:58:43
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00862826
Message ID:
00862845
Vues:
11
You might start off with an empty, unused, column, so you can later insert before the empty column. I don't know for sure whether this works.

You could also copy the entire array to a new array, but this might be slow for large arrays.

Another option is my array class (LargeArray, download #15699). No need to redimension; you can scatter array elements "all over the place"! (You can also have more than 2 dimensions, which is the reason I created it in the first place.) Slow, compared to the built-in array functions, and no support for the standard array functions.

>Yes, but it gives strang results too. The problem is that I want to add a third column...
>
>>Did you try ains() with the number "2" as the third parameter? "Inserts a column into a two-dimensional array. The new column is inserted just before the column specified with nElementNumber."
>>
>>>If I have an array like so:
>>>
>>>myarray(1,1)= "Item 1"
>>>myarray(1,2)= "Apples"
>>>myarray(2,1)= "Item 2"
>>>myarray(2,2)= "Oranges"
>>>
>>>and I want to add a 3rd column to the array so I will end up with the following:
>>>
>>>myarray(1,1)= "Item 1"
>>>myarray(1,2)= "Apples"
>>>myarray(1,3)= .F.
>>>myarray(2,1)= "Item 2"
>>>myarray(2,2)= "Oranges"
>>>myarray(2,3)= .F.
>>>
>>>How do I do it? When I redimension myarray(2,3) it looks like this:
>>>
>>>myarray(1,1)= "Item 1"
>>>myarray(1,2)= "Apples"
>>>myarray(1,3)= "Item 2"
>>>myarray(2,1)= "Oranges"
>>>myarray(2,2)= .F.
>>>myarray(2,3)= .F.
>>>
>>>The AINS() seems to do the same thing...
>>>
>>>TIA!
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform