Sum of items
Actually I use Bonita Studio Community 7.5.4
I have created a form where I have a collection with a field called subtotal, therefore for each new collection another subtotal field is added so that they can be from 1 to 10,100 or 1000.
How can I add up all the subtotals that are generated?
I think the best way to do this is in a script because I need the total value to meet a condition on a gateway or if it is possible to do it from the form, could you give me ideas on how to do it!
Thanks in advanced!
Assuming you have in your form a variable invoice with following structure
You can have an JS expression that does the math for subtotal and total of the invoice
var total =0;
var subtotal = item.quantity * item.unitCost;
item.subtotal = subtotal;
total += subtotal;
$data.invoice.total = total;
Hi Pablo thanks for answering!
So the form is created automatically with the contract for this reason my unique variables is formInput and forOutput.
also it is the firts form to start a process the variable JS doesn't have problem with this? and how add the value in the formInput?
The structure of de formInput is somethig like that
some variable of the contract : "",
more variables: "",