FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can calculations be done on field values?
#1
I have a database with fields for an allowance amount, an amount used and a balance.

Is it possible to set up fields on the admin side so that the amount used is subtracted from the allowance and displayed in the balance field?

I'm using 2.2.6
Reply
#2
You could try the Pre-Parser Module to handle the calculations on a submission (pulling the current balance of the desired record by submission_id), then update the calculated balance to the appropriate record (submission_id).
Reply
#3
Here's a link to the Submission Pre-parser module: http://modules.formtools.org/submission_pre_parser/

Cheers,

Joe
Reply
#4
Thank you very much.

John
(Apr 30th, 2014, 6:30 PM)Joe Wrote: Here's a link to the Submission Pre-parser module: http://modules.formtools.org/submission_pre_parser/

Cheers,

Joe

Reply
#5
I have used the pre_parser for calculations:

1. Create a form field called Pscore

2. Add the code into the pre_parser to populate the field. ie (field1 + field2 + field3) divide by 10

$sum = ("{$_POST["P1"]}" + "{$_POST["P2"]}" + "{$_POST["P3"]}" + "{$_POST["P4"]}" + "{$_POST["P5"]}" + "{$_POST["P6"]}" + "{$_POST["P7"]}") / 10;

$_POST["Pscore"] = ["$sum"];
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)