Page 1 of 1

Calculated fields in list tab using this list tab value

PostPosted: Thu Feb 07, 2013 3:02 am
by VeillecoJulien
Hi,


http://image.noelshack.com/fichiers/2013/06/1360230772-accounts.png
I have a "problem" with my List Tab. Here is my Accounts list tab and what I'm trying to do is to have a column, so a value for each line, where, with a SQL request, I could be able to display the number of project the Account is linked to.
I already have a working SQL request for this, a "SELECT (COUNT..." but I really don't know how to have a field display there.

The other problem being that to get the number of project I have to use the Accounts.id, a value from the Account table but which isn't display at the moment in the table. How can I take the ID of the Account table to use it in the SQL request ?

That's a bit complicated and I don't really know how to explain it but I think it's quite understandable :

I have to count a value from another table (linked by an ID to the Account table) and display it in the Account list tab but to get it I have to use the Account ID, so it's a bit complicated...


Any help will be appreciated, thank you in advance !

Re: Calculated fields in list tab using this list tab value

PostPosted: Thu Feb 07, 2013 9:55 am
by shannah
You can either:
1. Calculate this value periodically and cache it in a column of your table.
2. Use the __sql__ directive of the fields.ini file to graft the calculation on as a grafted field.

The first option will yield the best performance but can be cumbersome to maintain.
The second option will have slightly worse performance (because it will be doing a join and a subquery for every request on that table), but it has no maintenance overhead.

-Steve