Copy link to clipboard
Copied
How do I calculate the quantity (2) by the cost ($10) and (discount)? For example, (2*$10.00)*(1-15%)
Copy link to clipboard
Copied
What are the names of the fields involved?
Copy link to clipboard
Copied
Quantity
Cost
Discount
Total Cost
Copy link to clipboard
Copied
Is the Discount field a percentage field, or a number field?
Copy link to clipboard
Copied
I have attached the form for you to review. I would like to be able to enter 15 in the discount column and it convert to 15%. I would like for the “Total Cost” column to calculate the “Quantity” * “Cost for 1” * “Discount”.
Copy link to clipboard
Copied
You can't attach files here, only post a link to a file-sharing site.
If you want the user to enter "15" and have it show up as "15%" you would need to use custom keystroke and format scripts.
Let's say you've done that. The calculation code for the Total Cost field will then be:
var qty = Number(this.getField("Quantity").value);
var cost = Number(this.getField("Cost for 1").value);
var discount = Number(this.getField("Discount").value);
event.value = (qty*cost) * (1-(discount/100));
Copy link to clipboard
Copied
Is there a way to get the "Discount" to show as a percentage when a number is entered without needing to enter a decimal before the number? For example, 15 is entered but 1500% displays instead of 15%
Copy link to clipboard
Copied
As I said, this would require using custom Format and Keystroke scripts... For the Format script you can use this:
if (event.value) event.value += "%";
And for the Keystroke you can use this:
event.rc = !isNaN(AFMergeChange(event));
Copy link to clipboard
Copied
Thank you so much for all your assistance. The form is complete. You are awesome! Have a wonderful and blessed week!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now