>Thank you Sergey!
>
>You are a genius!
>Wow, with a mind buzzing like your's, how do you ever sleep?
>
>Uh, you do sleep... don't you?
>
>Thanks again,
Warning!!! You should create a function to encapsulate this trick. The name of said function can make it far easier to remember and read.
Working with Drew Speedie I had created such a routine which is still part of Visual MaxFrame Professional. This routine was contributed to the Fox community by Russ Swall in memory of Drew and published in my Foxpro Advisor Article: Let Coherence Lead You to Better Software.
Because we made it it's own .prg, it was easily expanded to not only check if something is an array, but if you pass an object and property name it can tell if that is an array too.
*
* X2IsArray.PRG
* RETURNs a logical value indicating whether the
* variable PASSED BY REFERENCE or the passed Object.Property
* is an array.
*
* Copyright (c) 2004-2005 Visionpace All Rights Reserved
* 17501 East 40 Hwy., Suite 218
* Independence, MO 64055
* 816-350-7900
*
http://www.visionpace.com*
http://vmpdiscussion.visionpace.com* Author: Drew Speedie
* Special thanks to Mike Yearwood and Chris Bohling
*
* USAGE
* =====================================
* IF X2IsArray(@m.SomeVariable)
* ...
* ENDIF
* IF X2IsArray(SomeObject,"SomeProperty")
* ...
* ENDIF
*
*
* lParameters
* tuVariable (R) Memory variable to be checked,
* passed here BY REFERENCE
* -OR-
* Object whose tcProperty is to be
* checked
* tcProperty (O) If tuVariable is passed as an object
* reference, this parameter is REQUIRED,
* and indicates the property of the
* tuVariable object that is checked for
* being an array
* If tuVariable is passed as a memory
* variable, DO NOT PASS THIS PARAMETER,
* or this routine will RETURN .F.
*
LPARAMETERS tuVariable, tcProperty
LOCAL llRetVal
DO CASE
******************************************************
CASE PCOUNT() = 1 AND NOT VARTYPE(m.tuVariable) = "O"
******************************************************
llRetVal = TYPE("ALEN(m.tuVariable)") = "N"
******************************************************
CASE PCOUNT() = 1 AND TYPE("ALEN(m.tuVariable)") = "N"
******************************************************
llRetVal = .t.
******************************************************
CASE VARTYPE(m.tuVariable) = "O" ;
AND VARTYPE(m.tcProperty) = "C" ;
AND NOT EMPTY(m.tcProperty)
******************************************************
llRetVal = TYPE("ALEN(m.tuVariable." + m.tcProperty + ")") = "N"
******************************************************
OTHERWISE
******************************************************
*
* you apparently haven't passed the parameters
* properly -- we could have RETURNed .NULL. here,
* but then every time you call X2IsArray(), you
* would have to check for .NULL, .T., and .F.
* rather than just .T. or .F., so it's up to you
* to pass the parameters correctly
* Roses are red
* Violets are blue
* To pass parms correctly
* Is all up to you
*
llRetVal = .f.
ENDCASE
RETURN m.llRetVal