Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Como saber si una variable es tipo array?
Message
 
To
07/02/2002 15:42:10
Fausto Garcia
Independent Developer
Lima, Peru
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00616974
Message ID:
00617497
Views:
30
This message has been marked as a message which has helped to the initial question of the thread.
Nunca me paso de tener que controlar que una variable sea de tipo array, pero la pregunta es interesante. Es extraño que el lenguaje no te devuelva el tipo array con las funciones VARTYPE() o TYPE().
Si ejecutamos un DISPLAY MEMORY LIKE myArray, si muestra que la variable 'myArray' es de tipo 'A' y si usamos el generador de expresiones (GETEXPR()), en la ventana de dialogo muestra un lista de las variables en memoria con su tipo y si hay una variable de tipo array le asigan una letra 'A', o sea, que internamente VFP debe distingirle el tipo al igual que los otros (caracter, lógico, etc.). Sería interesante conseguir el código de el generador de expresiones, tengo la vaga idea de que en alguna versión venia el fuente junto con los otros generadores (GENMENU, GENHTML, etc.)

Fausto, creo que como te han respondido anteriormente vas a tener que crear tu propia función de control del tipos, algo del tipo:

*---------------
cError = ON('ERROR')
ON ERROR nLen = -1
nLen = ALEN( myArray ) && ALEN() o cualquier otra función de arrays
ON ERROR &cError
? IIF(nLen = -1, "No es un array", "Ok")
*--------------

Saludos,
Ricardo._
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform