Calc element

varst

Member
Hi!
How can I make that the calculation works only when I add a new record? Is this possible in principle?

Thanks!
 
You'd have to add some code to test if there is a rowid in the data, for example by testing if your form's PK element is empty ..

Like ...

Code:
if (empty($data['yourtable___id_raw']) {
   // your code
}

Note however that it will still need to return a value.

It sounds like you are using a calc to "do other stuff" rather than simply return a value to display. If that's the case, it's much better to use a form PHP plugin, set to run "on new".

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top