Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Samir H.
  Where is Samir H.?
 Yogyakarta
 Indonesia
 Samir H.
 To: Tony Vignone
  Where is Tony Vignone?
 St Augustine
 Florida - United States
 Tony Vignone
 Tags
Subject: RE: Passing arrays to procedures
Thread ID: 268401 Message ID: 268530 # Views: 30 # Ratings: 0
Version: Visual FoxPro 9 Category: General VFP Topics
Date: Tuesday, July 13, 2010 3:48:58 AM         
   


> >
> > You may either not declare the array, in a ADIR(aArray) for example, and then check the type of the array:
> >
?VARTYPE(aArray)  && should return "A" if it was created

> > or you declare the array, and you check the type of an element:
> >
?VARTYPE(aArray[1])  && will return "L" (.f.) if it was NOT created.

> > If the expected value IS indeed logical, you can:
> >
IF VARTYPE(aArray[1])="L" AND aArray[1]
> > ...

> >
> > But it's true, you must go through such checking...
> >
> > Regards
> > Samir
>
> Thanks, Samir. Good analysis.
> Tony
>
> Remark:
>
?VARTYPE(aArray[1])  && will return "L" (.f.) if it was NOT created.
> aArray[1] = .F.
> ?VARTYPE(aArray[1])  && will return "L" (.f.) also and it was assigned a value!!!


I don't know what you mean, Tony. Try this
CLEAR 
LOCAL aArray[1]
?VARTYPE(aArray[1]),aArray[1]	&& "L" and .f.
aArray[1]=0
?VARTYPE(aArray[1]),aArray[1]	&& "N" and 0

RELEASE aArray
LOCAL aArray[1,2]
?VARTYPE(aArray[1,1]),aArray[1,1]	&& "L" and .f.
aArray[1]=0
aArray[2]="ABC"
?VARTYPE(aArray[1,1]),aArray[1,1]	&& "N" and 0
?VARTYPE(aArray[1,2]),aArray[1,2]	&& "C" and "ABC"



Regards
Samir

ENTIRE THREAD

Passing arrays to procedures Posted by Tony Vignone @ 7/11/2010 6:46:56 PM
RE: Passing arrays to procedures Posted by Samir H. @ 7/11/2010 7:15:34 PM
RE: Passing arrays to procedures Posted by Tony Vignone @ 7/12/2010 6:52:53 PM
RE: Passing arrays to procedures Posted by Borislav Borissov @ 7/11/2010 7:19:17 PM
RE: Passing arrays to procedures Posted by Tony Vignone @ 7/12/2010 6:51:23 PM
RE: Passing arrays to procedures Posted by Mike Yearwood @ 7/13/2010 3:38:03 PM
RE: Passing arrays to procedures Posted by Tony Vignone @ 7/14/2010 6:39:43 PM
RE: Passing arrays to procedures Posted by Anil Sharma @ 7/11/2010 7:31:36 PM
RE: Passing arrays to procedures Posted by Tony Vignone @ 7/12/2010 6:55:23 PM
RE: Passing arrays to procedures Posted by Eduard @ 7/11/2010 10:34:31 PM
RE: Passing arrays to procedures Posted by Tony Vignone @ 7/12/2010 7:02:24 PM
RE: Passing arrays to procedures Posted by Samir H. @ 7/12/2010 7:28:19 PM
RE: Passing arrays to procedures Posted by Tony Vignone @ 7/13/2010 3:08:33 AM
RE: Passing arrays to procedures Posted by Samir H. @ 7/13/2010 3:48:58 AM
RE: Passing arrays to procedures Posted by Tony Vignone @ 7/13/2010 4:33:38 AM
RE: Passing arrays to procedures Posted by Tamar Granor @ 7/12/2010 10:48:02 PM
RE: Passing arrays to procedures Posted by Tony Vignone @ 7/13/2010 3:07:39 AM
RE: Passing arrays to procedures Posted by Koen Piller @ 7/12/2010 11:37:18 PM
RE: Passing arrays to procedures Posted by Tony Vignone @ 7/13/2010 3:02:01 AM
RE: Passing arrays to procedures Posted by Koen Piller @ 7/13/2010 4:07:34 PM
RE: Passing arrays to procedures Posted by Samir H. @ 7/13/2010 5:56:25 PM
RE: Passing arrays to procedures Posted by Koen Piller @ 7/13/2010 8:43:23 PM
RE: Passing arrays to procedures Posted by Mike Yearwood @ 7/13/2010 10:36:16 PM
RE: Passing arrays to procedures Posted by Samir H. @ 7/14/2010 4:42:58 AM
RE: Passing arrays to procedures Posted by Mike Yearwood @ 7/14/2010 5:57:12 AM
RE: Passing arrays to procedures Posted by Samir H. @ 7/14/2010 7:22:33 AM
RE: Passing arrays to procedures Posted by Mike Yearwood @ 7/14/2010 7:13:43 PM
RE: Passing arrays to procedures Posted by Koen Piller @ 7/14/2010 10:21:59 AM
RE: Passing arrays to procedures Posted by Tony Vignone @ 7/14/2010 6:59:18 PM
RE: Passing arrays to procedures Posted by tushar @ 7/13/2010 6:02:24 AM
RE: Passing arrays to procedures Posted by Tony Vignone @ 7/14/2010 7:00:41 PM
RE: Passing arrays to procedures Posted by Mike Yearwood @ 7/13/2010 3:39:32 PM
RE: Passing arrays to procedures Posted by Christian Tabligan @ 7/14/2010 4:46:09 AM
RE: Passing arrays to procedures Posted by Samir H. @ 7/14/2010 4:54:22 AM
RE: Passing arrays to procedures Posted by Christian Tabligan @ 7/14/2010 5:48:51 AM
RE: Passing arrays to procedures Posted by Tony Vignone @ 7/15/2010 3:06:02 AM