Page 1 of 1

Filter/Scope dilemna

Posted: Tue Sep 04, 2007 1:20 pm
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

Posted: Tue Sep 04, 2007 1:48 pm
by Rick Lipkin
Greg

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

Rick

Posted: Tue Sep 04, 2007 1:53 pm
by Greg Gammon
Rick,
What does ord.ch accomplish? Is this to allow SET SCOPE?
G

Posted: Tue Sep 04, 2007 2:22 pm
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.

Posted: Tue Sep 04, 2007 2:27 pm
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

Posted: Tue Sep 04, 2007 3:12 pm
by Rick Lipkin
Greg

Ord.ch translates the Set Scope command.

RIck