Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Any Counter For Array? I can't find it if passing parame
Message
From
04/03/1998 04:23:38
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
04/03/1998 03:38:35
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00082426
Message ID:
00082429
Views:
28
>I want to know the array size of a passing array!
>e.g.
>
>Aused(NumUsedTable)
>CallFunc(NumUsedTable)
>
>Define Function CallFunc
>Lparameters AryName
>
>* then?

If you didn't touch the defaults, parameters are passed by value, DO..WITH pass params by reference regardless of "SET UDF ..". When you pass an array to a function, as you did, by value you actually pass the value of first item, not the array itself. To pass the array you should pass it by reference. To do it regardless of "SET UDF.." precede it with an "@" sign.
=Aused(aNumUsedTable)
=CallFunc(aNumUsedTable)

* Callfunc
lparameters aNumTables
? aNumTables    && First tablename
? aNumTables[2] && Produce error - aNumTables is not an array

=Aused(aNumUsedTable)
=CallFunc(@aNumUsedTable)

* Callfunc
lparameters aNumTables
? aNumTables    && First tablename
? aNumTables[2] && Second tablename and so on
Beware when you pass by reference you're actually passing the address of var so if the function changes the value it would be changed upon return.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform