Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
APPEND FROM ARRAY problems...
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00046997
Message ID:
00047009
Vues:
23
>Hi,
>
>I'm attempting to append from an array into a cursor. All I'm getting is the first row in the array. According to the help on VFP, APPEND FROM ARRAY is supposed to insert a row for every row in the array.
>
>Here is my 'test' code:
>
>DIMENSION laTest(3)
>laTest(1) = "1"
>laTest(2) = "2"
>laTest(3) = "3"
>CREATE CURSOR cTest (TestField C(1))
>APPEND FROM ARRAY laTest
>BROWSE
>USE IN cTest
>
>Any suggestions?

Jim,

Alex's solution points out an anomaly in FoxPro's array handling. Try this for yourself:

DIMENSION a_demo[1]
? ALEN(a_demo, 2)
* You'll get 0
DIMENSION a_demo[1, 1]
? ALEN(a_demo, 2)
* You'll get 1

This can cause a real headache if a routine checks an array to see if it has multiple columns. The code:

IF ALEN(a_anything, 2) = 1

will fail if the array isn't created using the second DIMENSION statement above.

Note, however, that both a_anything[2] and a_anything[2, 1] will always yield the same result. Provided, of course they exist ;-).

George
George

Ubi caritas et amor, deus ibi est
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform