Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ACOPY and ASCAN in 2 dimensional arrays
Message
De
25/07/2002 06:47:27
 
 
À
25/07/2002 06:31:28
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00682416
Message ID:
00682426
Vues:
17
Agnes

Thanks for the reply, I thought that I'd ask just in case you could do it in one command, I have had to use FOR...ENDFOR to achieve my results.

Thanks
Kev


>>Hi
>>
>>2 questions really, based on the same problem.
>>
>>If I have array1(10) and array2(10, 2), is it possible to copy the contents of array1 into array2, but only into the 1st dimension, ie. 10, 1 but not 10, 2?
>>
>>Also, can you ASCAN say, array2 and only return the 1st dimension row, rather than the element?
>>
>>Thanks in advance
>>Kev
>
>Hi Kevin,
>A foxpro array is allways one dimensional, it only appears as two dimensional. All operations like ACOPY, DIMENSION (try to change columns with DIMENSION) are bound first to the one dimensional array.
>
>Question 1:
>not with ACOPY but it's an easy:
>
>FOR lnLoop=1 TO ALEN(Array2,1)
> Array2(lnLoop,1) = Array1(lnLoop)
>ENDFOR &&lnLoop
>
>
>Question2:
>ASCAN gives you element number until you switch to version 7
>if you use an earlier version
>
>lnStart = 1
>*first time in Array
>lnElement = ASCAN(latest,lvValue_ToAsk,lnStart)
>*check for column:
>DO WHILE !EMPTY(lnElement) AND ASUBSCRIPT(latest,lnElement,2)#lnSearchedCol
> lnStart = lnElement+1
> lnElement = ASCAN(latest,lvValue_ToAsk,lnStart)
>ENDDO
>*first time right column
>IF !EMPTY(lnElement) THEN
> lnRow = ASUBSCRIPT(latest,lnElement,1)
>ELSE &&!EMPTY(lnElement)
>* not found
> lnRow = 0
>ENDIF &&!EMPTY(lnElement)
>
>
>ASCAN is a good reason to switch to VFP 7.0 ... ::)
>
>HTH
>Agnes
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform