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: Pete Sass
  Where is Pete Sass?
 Marathon, Ontario
 Canada
 Pete Sass
 Tags
Subject: RE: LOCATE FOR
Thread ID: 416437 Message ID: 416524 # Views: 26 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Databases, Tables and SQL Server
Date: Tuesday, December 30, 2014 6:55:18 PM         
   


> >
> > When using SET FILTER, it's better to avoid GO TOP and use LOCATE instead.
> >
> > 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.
>
>
> Hi Mike,
>
> Yep. I misread the OP and thought was doing a locate inside a Scan
> on the same table - lol
>
> However, I wonder the pros and cons of the two approaches.
>
> In a many to 1 scenario the locate to me makes sense. I ponder
> in a many to many where there are multiple record matches in
> the secondary table. Wondering what would be best in performance.
> Looping through the secondary table to flag the records versus
> setting a filter and issuing replace all with a one liner?
>
> Maybe if I get some free time I will benchmark this.
>
> Pete "the IceMan", from the Great White North of Canada.
> www.marathongriffincomputers.com

SET FILTER doesn't optimize across related tables. VFP SQL does. It should be faster with a single REPLACE compared to the looping.

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

LOCATE FOR Posted by Cecil Champenois @ 12/29/2014 6:34:17 PM
RE: LOCATE FOR Posted by Pete Sass @ 12/29/2014 7:11:17 PM
RE: LOCATE FOR Posted by Cecil Champenois @ 12/29/2014 9:38:00 PM
RE: LOCATE FOR Posted by Greg Green @ 12/29/2014 9:57:36 PM
RE: LOCATE FOR Posted by Pete Sass @ 12/29/2014 11:16:15 PM
RE: LOCATE FOR Posted by Mike Yearwood @ 12/30/2014 3:49:07 PM
RE: LOCATE FOR Posted by Pete Sass @ 12/30/2014 6:18:31 PM
RE: LOCATE FOR Posted by Mike Yearwood @ 12/30/2014 6:55:18 PM
RE: LOCATE FOR Posted by Mike Yearwood @ 12/29/2014 8:30:51 PM
RE: LOCATE FOR Posted by Cecil Champenois @ 12/29/2014 9:35:06 PM
RE: LOCATE FOR Posted by Tony Vignone @ 12/29/2014 9:03:34 PM
RE: LOCATE FOR Posted by Greg Green @ 12/29/2014 10:03:17 PM
RE: LOCATE FOR Posted by Tony Vignone @ 12/30/2014 3:27:40 PM
RE: LOCATE FOR Posted by David Myrick @ 12/29/2014 10:21:05 PM
RE: LOCATE FOR Posted by Jun Tangunan @ 12/30/2014 2:23:08 AM