Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Copy VFP Array to Excel
Message
 
À
09/12/2005 16:41:21
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01076673
Message ID:
01076981
Vues:
27
Cetin, Fabio, thanks.

No matter under what angle we consider this issue or how we call it, it is clear that we may meet problems if arrays (one-dimensional or not) are not defined the very same way (like in the example I provided in original post).

Probably it should be recommended to always redefine array like Cetin did:

dime a1[200]
.....
*or
copy field onefield to array a1
....

* Now redefine the array,
* Make sure that set compatible is OFF, otherwise the array will be destroyed. Thanks to Igor Koroljov for this comment.

set compatible OFF
Dimension a1[alen(a1,1),max(1,alen(a1,2)]
*

Thanks


>>Cetin,
>>
>>Yes, I understand that VFP works this way, but why? It look like a bug to me:
>>
>>
>>dimension a1[200]
>>dimension a2[200,1]
>>
>>One may then ask, how many columns there are in a1 and in a2?
>>
>>?Alen(a1,2)  && returns 0   ??
>>?alen(a2,2)  && returns 1
>>
>>
>
>Yuri, a bug is sure.
>
>When VFP use a array in COPY/APPEND/... commands
>it see a one dimensional array as a "one row x N columns"
>
>
>CLEAR
>DIMENSION onedimension[2] && bug VFP see this as [200,0] but correct is [1,200]
>
>? ALEN(onedimension,1),ALEN(onedimension,2) && 2,0
>
>onedimension[1] = 1
>onedimension[2] = 3
>
>CREATE CURSOR TEST (AA I,BB I)
>APPEND FROM ARRAY ONEDIMENSION && HERE VFP USE onedimension[1,2]
>BROWSE
>* then expected output of
>* ? ALEN(onedimension,1),ALEN(onedimension,2)
>* is 1,2
>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform