calculated field or/and automatically calculate and print

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

calculated field or/and automatically calculate and print

Postby sgaget » Thu Feb 16, 2012 6:31 am

I have in my table "ttt", two fields ttt_a and ttt_b.

How can I automaticly compute a third field ttt_c to be ttt_a*ttt_b?

I tried with the functions beforeSave or after_action_edit in the file
ttt/ttt.php with the instruction :
$record->setValue('ttt_c', $record->val('ttt_a')*$record->val('ttt_b'));

But it doesn't work! ;-(


I know this third field ttt_c is not necessairy because it's calculate. Therefore is it a way in the view page, the new entry page or in the modify page to have the ttt_a*ttt_b result near the widget label? (and automatically update when ttt_a or ttt_b is changed?)

Thanks and congratulation for Xataface.
sgaget
 
Posts: 2
Joined: Thu Feb 16, 2012 5:57 am

Re: calculated field or/and automatically calculate and prin

Postby shannah » Wed Feb 22, 2012 12:33 pm

This should have worked in the beforeSave() method.
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 9 guests

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