What are the names of the fields involved?
Is the Discount field a percentage field, or a number field?
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”.
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));
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%
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));
Thank you so much for all your assistance. The form is complete. You are awesome! Have a wonderful and blessed week!