Docs for calcuated fields? HELP!

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

Docs for calcuated fields? HELP!

Postby Chris » Sun Dec 12, 2010 4:40 am

I've spent hours looking for any documentation on using calculated fields, and I cannot find any! Could someone please point me in the right direction, or if there isn't give a brief primer (I won't need much, just how to get started).

I was expecting something like this.

field.ini
Code: Select all
[CALCFIELD]
widget:type = calc
widget:name = mycalcfield

atable.php
Code: Select all
class tables_mytable ...

function field_CALCFIELD(&$record) {
return 'the calculated value';
}



Where did I go wrong?
Chris
 
Posts: 14
Joined: Sun Dec 12, 2010 4:31 am

Re: Docs for calcuated fields? HELP!

Postby shannah » Mon Dec 13, 2010 10:58 pm

Your second attempt is close:

Code: Select all
function field__calcfield($record){
    return 'calculated value';
}


Then you can use the field programmatically:
Code: Select all
$record->val('calcfield');
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Docs for calcuated fields? HELP!

Postby Chris » Tue Dec 14, 2010 1:19 am

Wow, that shows something about the code quality when you can guess at a function name and get that close.
Very good system.
Chris
 
Posts: 14
Joined: Sun Dec 12, 2010 4:31 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 21 guests

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