EricDraven
Programmer
Hi all,
I have a large DBase containing a list of invoices which is linked to a customers table via a unique Custoomer Number. On my screen there is a DBGrid showing the customers info and a listview in report style to show the corresponding invoices which are displayed when the user selects a customer. Filters are too slow so I am populating the listview using an index as follows.
I have a large DBase containing a list of invoices which is linked to a customers table via a unique Custoomer Number. On my screen there is a DBGrid showing the customers info and a listview in report style to show the corresponding invoices which are displayed when the user selects a customer. Filters are too slow so I am populating the listview using an index as follows.
Code:
var
Customer : Integer;
Customer := Table1.FieldByName('CUSTOMER').AsInteger;
Table2.IndexName := 'CustomerNo';
Table2.First;
Table2.FindKey([Customer]);
while (Table2.FieldByName('CUSTNO').AsInteger = Customer) and (not Table2.EOF) do
begin
{Add items to Listview here}
Form1.Table2.Next;
end;
[\code]
The problem is that a lot of larger customers have quite a few invoices and my users would like to be able to change the criteria used in sorting them in the listview (by invoice date, type, price etc).
I have tried changing the listview to dbgrid with a query as its datasource but unfortunately the sql code took a few seconds to sort all the relevant data. Im hopelesly stumped as to how to quickly sort the data on screen so any ideas would be greatly appreciated! [machinegun] [bugeyed]
Arte Et Labore [rockband]