Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ACOPY, bug or am I missing something
Message
De
22/04/2002 23:29:19
 
 
À
18/04/2002 07:21:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00646234
Message ID:
00647965
Vues:
19
FWIW: you only need to DIMENSION destination(1) [Not (1,1)] before the ACOPY() to get it to be the same size as the source array. Probably doesn't matter either way, but I've found that when I'm reviewing my code seeing (1) always tells me that I'm about to change the dimensions somehow. Seeing {1,1) tells me that I specifically want it to only be 1 element long.




>Thanks Agnes
>
>Yes, I've just re-read the help and noticed that it only sets the correct dimensions on a new (or I expect .F. set array?), so what I've done is just type:
>
>
DIMENSION laArray(1, 1)
>
>before the 2nd ACOPY and that seems to work also.
>
>Still a bit strange though!
>
>Cheers
>Kev
>
>>>Hi
>>>
>>>OK, I have a property (which is an array) in my object which I ACOPY into a local array, I thought that ACOPY increases the elements in a destination array to match the source array, this works fine the first time, but when I want copy another property (array) into the same local array, it errors.
>>>
>>>Sample code:
>>>
LOCAL laOutput(1, 1)
>>>
>>>*Copy first array (this works fine)
>>>=ACOPY(this.aArray1, laOutput)
>>>
>>>*Copy second array (this errors)
>>>=ACOPY(this.aArray2, laOutput)
>>>
>>>
>>>
>>>this.aArray1 is [6, 9] and this.aArray2 is [7, 9].
>>>
>>>Any ideas?
>>>
>>>Thanks
>>>Kev
>>
>>Hi Kevin,
>>acording to Help dimension of DestinationArray is changed on if DestArray not exists.
>>But this is not very clear.
>>ACOPY is a little bit tricky because it seems to work like
>>
>>FOR lnloop = 1 TO ALEN(SourceArray)
>> DestArray(lnloop)=SourceArray(lnloop)
>>ENDFOR
>>
>>so you better do
>>
>>DIMENSION laOutput(ALEN(this.aArray2,1),ALEN(this.aArray2,2))
>>=ACOPY(this.aArray2, laOutput)
>>
>>
>>Agnes
Bill Morris
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform