>grid to narrow the search. Because of the size of the table that the grid
>is based on, SET FILTER takes _forever_. I would like to be able to execute
>an SQL query, and change the recordsource of the grid to the resulting
>cursor. Issuing the query and changing the recordsource to the cursor are
>easy enough, but the indexing is posing a problem, because as far as I
>know, you can only index tables and views. Is the only way to do this to
>put the results into a table and then use and index the table? If so, where
There are two ways out: if you can have the order set to the index you
are using for search, you may take a look at the "Set Key To /value/"
command - it will immediately narrow the view on your data to only those
records having the /value/ in the key field.
You can index cursors as well. If you have a read-only cursor, you can
place one tag on it without problems. If you need more tags, you can
either Use that cursor Again Alias SomethingElse, or index it to a
non-structural index file, like this:
Select * from original_alias;
where condition;
into cursor temp1
cdxname_lc=sys(3)
index on field1 tag first of (CdxName_lc)
index on field2 tag second of (CdxName_lc)
....
index on fieldn tag enth of (CdxName_lc)
There are two good reasons for using random name for the cdx file.
First, network. You may have your temp directory (backslash included) in
a tmpdir_gc variable, and do
cdxname_lc=TmpDir_gc+sys(3)
Second, in case of crash your .cdx may still live on the disk, in the
same directory where you left it. If its name is not random, next time
you try to index to it, fox will try to open it, and if it's crashed,
your app will break.