juank
asked on
Filterin a database at runtime
Hi guys!! I'm here again.
Now I have a simple question but I cannot find the solution, and I hope thay you genius will help me.
How can I specify a filter on a Paradox table at runtime?, i.e. supposing the Customer No changes according the user selection, I want to display a grid
with the invoices of that customer.
The fact is that I can't find the way to write in my source code something like Table1.Filter := ....
So, can anybody of you send me the right syntax. I think it's easy, but so far I couldn't solve it.
Thanks again
Juan Carlos
Now I have a simple question but I cannot find the solution, and I hope thay you genius will help me.
How can I specify a filter on a Paradox table at runtime?, i.e. supposing the Customer No changes according the user selection, I want to display a grid
with the invoices of that customer.
The fact is that I can't find the way to write in my source code something like Table1.Filter := ....
So, can anybody of you send me the right syntax. I think it's easy, but so far I couldn't solve it.
Thanks again
Juan Carlos
to expand on my last comment:
Take the animals table that ships with Delphi (listed in DBDEMOS)... drop that on a form with a TTable,Datasource and a DBGrid. Now in a button click event add this code:
Table1.Filter:='Size>2';
Table1.Filtered:=True;
Now run the project... before hitting the button, you'll see every listing i the table, afterwards you'll only see those where Size>2. Alternatively, you could use a TQuery, assigning it as Dataset to the DataSource. This way you could do LIKE and ORDERBY queries as well.
Good luck!!
Take the animals table that ships with Delphi (listed in DBDEMOS)... drop that on a form with a TTable,Datasource and a DBGrid. Now in a button click event add this code:
Table1.Filter:='Size>2';
Table1.Filtered:=True;
Now run the project... before hitting the button, you'll see every listing i the table, afterwards you'll only see those where Size>2. Alternatively, you could use a TQuery, assigning it as Dataset to the DataSource. This way you could do LIKE and ORDERBY queries as well.
Good luck!!
you can also do a master-detail relationship between
customer-tabel and invoices-table
just set on the invoices-table as mastersource the datasource of the customer-table and set the masterfields
with the dialog there
no filter is then required,
delphi does this now automatically
meikl ;-)
customer-tabel and invoices-table
just set on the invoices-table as mastersource the datasource of the customer-table and set the masterfields
with the dialog there
no filter is then required,
delphi does this now automatically
meikl ;-)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That's exactly what I was lookig for.
Thanks!!!
Thanks!!!
Table.Filtered:=True;
Good luck!!