Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Mike Yearwood
  Where is Mike Yearwood?
 Toronto
 Canada
 Mike Yearwood
 To: Samir H.
  Where is Samir H.?
 Yogyakarta
 Indonesia
 Samir H.
 Tags
Subject: RE: Passing arrays to procedures
Thread ID: 268401 Message ID: 268704 # Views: 27 # Ratings: 0
Version: Visual FoxPro 9 Category: General VFP Topics
Date: Wednesday, July 14, 2010 5:57:12 AM         
   


Samir

Just use http://fox.wikis.com/wc.dll?Wiki~X2ISARRAY

In VFP itself they altered TYPE() so it could accept an extra parameter, but that would mean searching every line of code for the TYPE(). Vartype was added because TYPE() is slower.

Now, I know a UDF may seem like overkill to some, but the point is to take something complex, error prone, mysterious and unreadable and make it reliable, maintainable, extendable and a UDF does that.



> Hi Koen
> I still have lots of arrays in my code, which I start getting rid off. I thought you gave a way to avoid the multiple testings necessary when working with arrays. I checked what you wrote and found that it does not work
>
> > … Tony wants to know if an array exists and is therefore applying the command dimension…
> If you don’t declare them, the results with alen() are still the same, or even worse: you get an error if the array was not created.
>
> > … and you come with lots of arguments about a 2-diomensional array…
> These are 1 dimentional arrays. I added the 2-dim arrays for further testing.
>
DIMENSION aArr[1]
> ?ALEN(aArr)		&& returns 1
> ?
> DIMENSION aArr[1]
> aArr[1]="A"		&& -> element has a value set.
> ?ALEN(aArr)		&& returns 1

>
> > What is your point here?
> My point was I just couldn’t figure out how you can use ALEN() for such checking. It was not my intention to criticize you. An example of how you do it with ALEN() would help…
>
>
> >
> >
> >
> > Samir,
> >
> > Maybe I dont understand. But mu understanding of < if something exists> is that something is there and not what something contains, and if something contains something it is there, but again maybe I am wrong.
> >
> > Please consider Tony wants to know if an array exists and is therefore applying the command dimension, that is in my opinion wrong.
> > with dimension you give a dimension to an array.
> > with alen() you can check the length of an array.
> > I pointed that in the help file you can check quote If the array is a one-dimensional array, ALEN( ) returns 0 (no columns).unquote and you come with lots of arguments about a 2-diomensional array.
> > What is your point here?
> > Furthermore it is not my habit to react in this way but Tony was, lets say it nicely, telling us VFP is a lousy language without again, saying it nicely, not nowing the least of the language judging his questions.
> >
> > Regards,
> >
> > Koen
>
>
>
> Regards
> Samir



Mike Yearwood
Microsoft MVP Visual FoxPro 2008, 2009
We have enough youth. We need a fountain of smart!
There may be many ways to skin a cat, but there are very few right ways to do it.

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