CMFILTER, CMCLRFILTER
Moderator: Rathinagiri
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
CMFILTER, CMCLRFILTER
Hi Theo,
Could you please attach a practical example please ?
Could you please attach a practical example please ?
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Re: CMFILTER, CMCLRFILTER
Hi Pablo,
The power is the amazing speed compared to a 'normal' set filter to command. Even with quite large databases the filter works very quick because it takes advantage of the index file.
Theo
No problem, here a simple example using cmFilter() and cmClrFilter() combined in a Browse control.Could you please attach a practical example please ?
The power is the amazing speed compared to a 'normal' set filter to command. Even with quite large databases the filter works very quick because it takes advantage of the index file.
Theo
- Attachments
-
- browse_filter4.zip
- (1.53 MiB) Downloaded 289 times
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Re: CMFILTER, CMCLRFILTER
Really fast !
.. and very easy...
Thank Theo.
.. and very easy...
Thank Theo.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
-
- Posts: 682
- Joined: Tue Jun 04, 2013 6:33 pm
- Location: Argentina
Re: CMFILTER, CMCLRFILTER
Hi Theo:
An efficient solution.-
Excellent job.-
This opens multiple searchs on a grid / browse.-
Thanks for your effort and thanks for share it with all of us.-
Eduardo
An efficient solution.-
Excellent job.-
This opens multiple searchs on a grid / browse.-
Thanks for your effort and thanks for share it with all of us.-
Eduardo
- Clip2Mania
- Posts: 99
- Joined: Fri Jun 13, 2014 7:16 am
- Location: Belgium
Re: CMFILTER, CMCLRFILTER
Very nice to see that my record collection is still of any use
Re: CMFILTER, CMCLRFILTER
+1
Muchas Gracias.
Muchas Gracias.
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: CMFILTER, CMCLRFILTER
AFAIR that is the way that FoxPro used to manage SET FILTER, LOCATE FOR and all other commands with a FOR condition.
So, a suggested techique at that time, was to 'cook' the database, meaning, to create indexes for every field that you think could be involved in a search condition.
So, supossedly LOCATE FOR in FoxPro, was faster that Clipper one, if you have the required indexes created.
The way that FOR clause work (using indexes or not) were handeld by SET OPTIMIZE command.
So, a suggested techique at that time, was to 'cook' the database, meaning, to create indexes for every field that you think could be involved in a search condition.
So, supossedly LOCATE FOR in FoxPro, was faster that Clipper one, if you have the required indexes created.
The way that FOR clause work (using indexes or not) were handeld by SET OPTIMIZE command.
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
CMFILTER, CMCLRFILTER
Thanks Roberto for your clarifications.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Re: CMFILTER, CMCLRFILTER
Hello to all,
I have never found filters work on large tables. That is why I use temp indexes. I hope these temp indexes are not making my black grid.
If I have a table of 100,000 items called table1 with index table1.ntx. I create a temp index from seconds() so it is the only index of this value.
I use ntx indexes... I do
use table1
TFIL:= STR(SECONDS(),9,3)
TFIL := 'tp'+ SUBSTR(TFIL,7,3)
SELECT table1
INDEX ON fieldname TO &TFIL FOR fieldname = your filter'
SET INDEX TO &TFIL , table1.ntx
GO top
program ..............
close table1
tfil := tfil+'.ntx'
delete (tfil)
I have used this for years and it is very fast on big tables. I can add and delete because the tables index(s) are in play.
No data loss for you are in the regular table.
Years ago I tried temporary tables but this was slow and there was a chance for data loss.
I have never found filters work on large tables. That is why I use temp indexes. I hope these temp indexes are not making my black grid.
If I have a table of 100,000 items called table1 with index table1.ntx. I create a temp index from seconds() so it is the only index of this value.
I use ntx indexes... I do
use table1
TFIL:= STR(SECONDS(),9,3)
TFIL := 'tp'+ SUBSTR(TFIL,7,3)
SELECT table1
INDEX ON fieldname TO &TFIL FOR fieldname = your filter'
SET INDEX TO &TFIL , table1.ntx
GO top
program ..............
close table1
tfil := tfil+'.ntx'
delete (tfil)
I have used this for years and it is very fast on big tables. I can add and delete because the tables index(s) are in play.
No data loss for you are in the regular table.
Years ago I tried temporary tables but this was slow and there was a chance for data loss.
All The Best,
Franco
Canada
Franco
Canada
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: CMFILTER, CMCLRFILTER
I completely agree with you.
In the last years I've discovered the fact that creating conditional indexes is extremely fast, so I never use filters, I use conditional temporary indexes to show queries instead.
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)