Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filtering, Column Totals (autocalc) Indexes repair need help

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0


I need to filter a table, I've got the following fields:

SURNAME AGE LANGUAGE Score
BOTHA 18 Afrikaans 90
BOTHA 17 Afrikaans 82
BOTHA 21 English 63


I need to be able to see(just) the combination say of all the surnames BOTHA and with language afrikaans.

In general I can't seem to get the filtering to work.

Then how so I use autocal, say to display the total of a column of data. Which command do I use? Edit1:=Table1.???????;

And then, I use a dbase database, the indexes seems to corrupt themselves. It's not my programming that causes it, cause I use simple grids and delphi controls.

How do I rebuild an index in delphi, I do it now by using the database desktop - to repack, or recreate.

Any help would be great! Thanx for the help with the decimals. I got it right!!!!

Hennie

 
To filter out 2 colomns at a time looks cumbersome to me.
Why don't you use a Tquery?

Depending of what type of database and edition of Delphi, you have various ways to construct the query

This example is generated by the SQL Builder from the client-server edition

SELECT surname, age, language, score
FROM "Mydata.db" Mydata
WHERE (surname = 'BOTHA')
AND (language = 'afrikaans')

Regards S. van Els
SAvanEls@cq-link.sr
 
I use delphi 3. I have never used TQuery. Basic principals to implement would be of much help. Thank you.

Hennie
 
It is almost like a table, but much more flexible.

You need a query, a dataset and some data aware controls in the same combination like ttable and tdataset.

The property you will not encounter is TableName[/], which is substituted by SQL. Here you key in your sql statements.

Depending of which Edition of Delphi, if you right click the tquery, you will see the SQL builder. This is a graphical query tool.

Unfortunately SQL Builder is not available in the standard edition.

If you have the Standard edition, and do not know SQL, use the Database Desktop for making queries in paradox or dbase files.

Select the table(s) you need in a query and run it. Highlight the query, go to the menu option Query -> Show SQL, and with cut & paste bring the SQL statements over to your tquery.sql in delphi.


If you are using m$ access design your query in access and select SQL View (same cut & paste)


Do not forget to use the Database Form wizard with Tqueries to see how the whole thing functions.


After you master queries I do not think you will use much tables, because it opens the way to multi-user systems and RDBMS like SQL-sever, Oracle, Interbase etc.

Regards S. van Els
SAvanEls@cq-link.sr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top