Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing Array and Compile Errors
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Passing Array and Compile Errors
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01618488
Message ID:
01618488
Vues:
85
I must be having a senior moment but I can't figure out how to pass an array parameter to a Fox function and not get the following error:

Unknown LAARRAY - Undefined

The function I have takes an array parameter by reference:
FUNCTION ArrayToCollection(laArray, lnMode)
LOCAL lnX, lnCount, lcClass, loCol, laArray

lnCount = ALEN(laArray)

IF EMPTY(lnMode)
   lnMode = 0
ENDIF   

IF lnMode = 2
	lcClass = "wwCollection" && avoid pulling into project
ELSE
    lcClass = "Collection"	
ENDIF	

loCol = CREATEOBJECT(lcClass)
FOR lnX = 1 TO lnCount
   loCol.Add(laArray(lnX))
ENDFOR

RETURN loCol
The compile error occurs at the point of the array usage (laArray(lnx)) and I can't recall how you can get the compiler to quiet down on this. The code actually compiles and runs fine - it's just a compiler 'warning' really, but its annoying.

So how do you get the compiler to accept this? I tried using LOCAL ARRAY laArray[1] which shuts up the compiler but causes the array to be truncated to 1 element.

+++ Rick ---
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform