Posts: 30
Threads: 18
Joined: Mar 2014
Reputation:
0
Apr 25th, 2014, 12:36 PM
(This post was last modified: Apr 25th, 2014, 12:47 PM by jgold723.)
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
Posts: 41
Threads: 9
Joined: Aug 2009
Reputation:
0
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).
Posts: 2
Threads: 0
Joined: Feb 2017
Reputation:
0
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"];