Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Tony Vignone
  Where is Tony Vignone?
 St Augustine
 Florida - United States
 Tony Vignone
 To: Tom Saddul
  Where is Tom Saddul?
 Paranaque
 Philippines
 Tom Saddul
 Tags
Subject: RE: Name of a Variable
Thread ID: 227055 Message ID: 228367 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 Category: General VFP Topics
Date: Monday, May 18, 2009 3:52:23 PM         
   


> > >FUNCTION searchFor(arr,arrName,nStartat,predicate)
>
> Ok now I understand why you have to pass the name of the array and inside you use STRTRAN to replace it with the name 'arr' for evaluation.
>
> The following concept should guide you. Clipper 5.x has what we call Code Blocks where such problem can EASILY be solved. C#.NET has "delegate"s that can also easily do the same. In VFP, the EVALUATE and macro (&) substitution can do it just like what you did here.
>
> Now, what is the problem with SearchFor()? I think it has done its job (not tested myself). However, it may be a general solution but a slow solution because you use EVALUATE("a complex expression") for each element. If I were you, I will not use SearchFor() in this kind of search. I would rather just search that normal hard way.
>
> I am only responding to you as I hope I am helping in the end. I hope you are not getting mad at it. The experts here have not responded yet except Tushar.

Again, thank you for you response. I want to use the function because there are so many searches for so many things in the free text. Loops everywhere would obfuscate the code and I'm a stickler for readability. In my application, I found no degradation of performance - computers are too fast today to worry about that and clarity of code is more important because of future maintenance. If you can't maintain code, then it is worthless! That's why I created the function in the first place. I wrote the code without it last year and was trying to change it this month and found it incredibly difficult. So I simplified the code with the function.

I'm going to explore evaluate() and macro substitution used together as you inferred. Lets see what happens.

Thanks again,
Tony

ENTIRE THREAD

Name of a Variable Posted by Tony Vignone @ 5/6/2009 4:05:35 PM
RE: Name of a Variable Posted by Tom Saddul @ 5/6/2009 4:22:19 PM
RE: Name of a Variable Posted by Tony Vignone @ 5/6/2009 4:57:45 PM
RE: Name of a Variable Posted by Tom Saddul @ 5/6/2009 5:37:24 PM
RE: Name of a Variable Posted by Tony Vignone @ 5/6/2009 5:43:49 PM
RE: Name of a Variable Posted by Tony Vignone @ 5/6/2009 5:58:58 PM
RE: Name of a Variable Posted by Tom Saddul @ 5/6/2009 6:19:08 PM
RE: Name of a Variable Posted by Tony Vignone @ 5/14/2009 3:19:11 PM
RE: Name of a Variable Posted by Tom Saddul @ 5/17/2009 10:09:28 AM
RE: Name of a Variable Posted by Tony Vignone @ 5/17/2009 7:31:52 PM
RE: Name of a Variable Posted by Tom Saddul @ 5/18/2009 8:09:44 AM
RE: Name of a Variable Posted by Tony Vignone @ 5/18/2009 3:52:23 PM
RE: Name of a Variable Posted by Tom Saddul @ 5/19/2009 3:41:37 PM
RE: Name of a Variable Posted by Tony Vignone @ 5/19/2009 4:02:11 PM
RE: Name of a Variable Posted by Tony Vignone @ 5/18/2009 6:20:29 PM
RE: Name of a Variable Posted by Samir Ibrahim @ 5/19/2009 6:56:28 PM
RE: Name of a Variable Posted by Tony Vignone @ 5/19/2009 9:10:40 PM
RE: Name of a Variable Posted by Samir Ibrahim @ 5/20/2009 10:21:14 AM
RE: Name of a Variable Posted by Tony Vignone @ 5/20/2009 6:34:39 PM
RE: Name of a Variable Posted by Tom Saddul @ 5/21/2009 1:52:57 AM
RE: Name of a Variable Posted by Tony Vignone @ 5/21/2009 7:33:39 PM
RE: Name of a Variable Posted by Samir Ibrahim @ 5/21/2009 10:35:02 AM
RE: Name of a Variable Posted by Tony Vignone @ 5/21/2009 7:58:52 PM
RE: Name of a Variable Posted by Samir Ibrahim @ 5/22/2009 11:04:13 AM
RE: Name of a Variable Posted by Tony Vignone @ 5/22/2009 3:07:38 PM
RE: Name of a Variable Posted by tushar @ 5/6/2009 6:10:53 PM