Filter/Scope dilemna

Post Reply
User avatar
Greg Gammon
Posts: 105
Joined: Fri Jun 09, 2006 3:27 pm
Location: Bryan, Texas

Filter/Scope dilemna

Post by Greg Gammon »

I need some ideas on how to accomplish a multiple filter that will work fast. I have four separate browses in a window with different filters working from the same database ...and the filter will change dynamically based on user input also.

SET FILTER TO UPPER(jobdate1->status) != "COMPLETE" .AND. jobdate1->scheddate = dDate1 .AND. jobdate1->presscode = cPressCode

Obviously FILTER is SLoooowwwww. It can take upwards of 4-5 seconds to paint the screen or change the view.

Are there any techniques to accomplish this that will be faster?

I was experimenting with a combination of FILTER and SET SCOPE, but couldn't even get the SET SCOPE beyond a compiler error ("parse error at SCOPE".... SET SCOPE TO dDate1...indexed on date).

Ideas are appreciated! Thanks.... Greg
User avatar
Rick Lipkin
Posts: 2397
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Post by Rick Lipkin »

Greg

Add #include "ord.ch" to the top of your .prg

Rick
User avatar
Greg Gammon
Posts: 105
Joined: Fri Jun 09, 2006 3:27 pm
Location: Bryan, Texas

Post by Greg Gammon »

Rick,
What does ord.ch accomplish? Is this to allow SET SCOPE?
G
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Post by StefanHaupt »

Greg,

create an index file with the filter you need for the browses and open the database in 4 different workareas and use the accompanying index tag in every workarea. So every browse can have its own scope.
kind regards
Stefan
User avatar
Greg Gammon
Posts: 105
Joined: Fri Jun 09, 2006 3:27 pm
Location: Bryan, Texas

Post by Greg Gammon »

Yes, that is essentially what I am doing. The problem with FILTER though is it must evaluate every record of the database so it is much slower than SCOPE...but SCOPE will allow for only one key evaluation...and I need three.

What I am contemplating is copying to a temp database based on two keys which and using SCOPE for the third key...but then when a record is changed, I have to go back and change it in the main database (goto recno() having recorded the recno in the temp database)...just not very elegant...searching for a better way.

Thanks for the help!
G
User avatar
Rick Lipkin
Posts: 2397
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Post by Rick Lipkin »

Greg

Ord.ch translates the Set Scope command.

RIck
Post Reply