Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to determine if property is array, collection, etc
Message
 
 
To
20/10/2008 08:42:49
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01355841
Message ID:
01355855
Views:
26
Why use a kludge when you can use TYPE(,1) ?
lcType = TYPE('oObject.oProperty',1)  
DO CASE 
CASE WHEN lcType = 'C'
  * Collection
CASE WHEN lcType = 'A'
  * Array
OTHERWISE
  * Something else
ENDCASE
>Thanks very much --- I guess I've grown accustomed to using VarType, and forgot about Type.
>
>Would the following work to distinguish between arrays and collections?
>
>lcProperty = 'oObject.oProperty'
>Try
>    lnCount = eval( lcProperty + '.Count')
>    * Collection here
>Catch
>   * Array here
>EndTry
>
>
>Thanks
>
>>The VARTYPE() will tell you the type of existing property/variable/field, excluding arrays/collections
>>
>>* Array/collection
>>TYPE(,1)
>>
>>
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform