Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with recursion and 'INTO ARRAY' clause
Message
De
20/04/2006 16:26:23
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01114610
Message ID:
01115140
Vues:
11
I was able to get mine to work just fine by using the Local array with the code I originally provided. My problem was unrelated to the array scoping or the recursion.

I was making a bone headed mistake of passing the wrong number of arguments to my subroutine that wrote to the cursor. Instead of passing three parameters to the subroutine, in one of the calls I was only passing two parameters.

For example,
DO WriteBOM WITH laArray(lncounter,1), laArray(lncounter,2)

Procedure WriteBOM
Parmeters lcItem, lnQty, lcUM

*** lcUM always is .F. because I forgot to pass the 3rd parameter
*** I was misassigning blame to the array 

RETURN
>I have had the same problem. I try uniquely naming the array in ever child call. Try using your lnCounter parameter and declare your array name in a macro to make it unique in every call.
>
>lcArrayName = "laArray" + alltrim(str( lnCounter ) )
>
>LOCAL ARRAY &lcArrayName (1)
>
>other code...
>
> * access array like this, make sure and put in a TYPE() or VARTYPE() check
> * to ensure the array exists
> FOR lnCounter = 1 to ALEN( &lcArrayName, 1 )
> Variable = &lcArrayName[ lnCounter ]
> ENDFOR
>
>
>* at end of function release array
>RELEASE &lcArrayName
>
>...
>
>RETURN
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform