Hello lectrond,
You'll see that calculated fields are pretty straightforward. As you already known, calculated fields are special database table fields that can calculate whatever you want (to some extend) and in MVD they contain a SQL query.
Let's say you have three tables in you database:
table writer with id and writer_name
table books with id and book_title
table writer_books with id_writer and id_books
This third table is there to link writers and books.
Now, in the writer table you can had a calculated field to count for each writer the number of books they are linked to, for example to display that number in a tablegrid.
The calculated field that we will had to the writer table and call nb_books looks like :
(SELECT (SELECT COUNT(id_book) FROM writer_books WHERE writer_books.id_writer = writer.id)
And that's it. By referencing the writer id in the calculated field you are making a direct reference to each writer and thus calculating the number of books for each of them.
All that is left to do now, is to include that calulated field in your tablegrids.
Hope this helped
Cheers
Mathias
PS : if you need an example project, I can fast build one for you, just now I'm off to work, so that was just a race again my fellow forum members that are usually quite fast to answer , they will recognize themselves
I'm a very good housekeeper !
Each time I get a divorce, I keep the house
Zaza Gabor