Subject Re: indexing table
From Mervyn Bick <invalid@invalid.invalid>
Date Wed, 30 Nov 2022 10:57:58 +0200
Newsgroups dbase.getting-started

On 2022/11/29 22:31, Moses Hanna wrote:
> Good Day
>                 local  I
>                 I = form.cldm.INVOICES1.rowset
>                 _app.newinvid = i.fields["invid"].value
>                i.filter = "invid = '" + _app.newinvid + "'"                
>                 u = new UpdateSet()
>               u.source = I
>              u.destination = "invoicereport.DBF"
>            u.copy()
> I want to index the new table "invoicereport.dbf"
> can i have some help how to do that?

It looks as if you are creating a temporary table containing records
extracted from the main table for a single invoice.  If this is correct,
there is no need to create an index.  Simply add an ORDER BY clause to
the SELECT statement in the report's query.  The ORDER BY clause will
make the rowset in the report read-only but this shouldn't be a problem.
  In fact, when one drags a table onto the report designer, the report
designer sets the query to be read-only anyway.

sql = "select * from invoicereport order by whatever_fld"

If you want the rowset ordered by more than one field instead of
concatenating the fieldnames with a + as you would for an index simply
add the fields with a comma between them

" ...... order by whatever_fld, whatever_fld1"

This raises the question, do you really need to create a temporary table
for your report?

The following in your report's query should do the trick.

sql = "select * from invoice where invid = '"+_app.newinvoice+"' order
by whatever_fld"