Calculated fields in list tab using this list tab value

A place for users and developers of the Xataface to discuss and receive support.

Calculated fields in list tab using this list tab value

Postby VeillecoJulien » Thu Feb 07, 2013 3:02 am

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 !
VeillecoJulien
 
Posts: 6
Joined: Tue Jan 22, 2013 9:00 am

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

Postby shannah » Thu Feb 07, 2013 9:55 am

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
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 1 guest

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved