Copy link to clipboard
Copied
I've been looking for over an hour, so I apologize if someone has already asked this and I just can't find it!
I have an order form with 5 lines of "quantity" and "unit price"; I need the "total" box to show the total of all 5 lines of their quantity times price. I know I could add another column of a subtotal for each line and then just add those subtotals up, but I think that's just cluttering up the form.
Copy link to clipboard
Copied
As the custom Calculation script of the Total field enter the following script:
var total = 0;
for (var i=1; i<=5; i++) {
total+=Number(this.getField("Quantity "+i).valueAsString) * Number(this.getField("Price "+i).valueAsString);
}
event.value = total;
Copy link to clipboard
Copied
YOU'RE. THE. BEST. Thank you so much, it worked perfectly!