The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
Can calculations be done on field values? - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1) +--- Forum: General Discussion (https://forums.formtools.org/forumdisplay.php?fid=5) +--- Thread: Can calculations be done on field values? (/showthread.php?tid=3004) |
Can calculations be done on field values? - jgold723 - Apr 25th, 2014 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 RE: Can calculations be done on field values? - bill09 - Apr 30th, 2014 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). RE: Can calculations be done on field values? - Joe - Apr 30th, 2014 Here's a link to the Submission Pre-parser module: http://modules.formtools.org/submission_pre_parser/ Cheers, Joe RE: Can calculations be done on field values? - jgold723 - May 1st, 2014 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/ RE: Can calculations be done on field values? - DSIN - Feb 13th, 2017 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"]; |