Copy link to clipboard
Copied
i am trying to calculate a cell in my form which will allow an automatic fill in from a percentage of a total amount from another cell. How do I accomplish this.
OK, you didn't explain it clearly. You want the result to show under "Total Funding Request 50 of cost up to 5000"... Use this code as that field's custom calculation script:
var v = Number(this.getField("CostTotal Cost").valueAsString);
event.value = Math.min(v/2, 5000);
Copy link to clipboard
Copied
What's the name of the other field, and what percentage do you want to show?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Use this code as the field's custom calculation script:
var v = Number(this.getField("Total Funding Request 50 of cost up to 5000").valueAsString);
event.value = Math.min(v/2, 5000);
Edited: Sorry, should have been min, not max, of course...
Copy link to clipboard
Copied
Copy link to clipboard
Copied
The first thing to learn is if you're getting an error, specify what the contents of the error are...
Copy link to clipboard
Copied
Copy link to clipboard
Copied
That's what my script does. And I don't see you posted any such thing here, but if you're not willing to do it then I can't help you further. Good luck.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
That means the value of your text field can't be converted to a Number.
Copy link to clipboard
Copied
Maybe share your file with us for further help with these issues.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
It did not come through. You can't attach it via an email reply, if that's what you're trying to do.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
OK, you didn't explain it clearly. You want the result to show under "Total Funding Request 50 of cost up to 5000"... Use this code as that field's custom calculation script:
var v = Number(this.getField("CostTotal Cost").valueAsString);
event.value = Math.min(v/2, 5000);
Copy link to clipboard
Copied
Thank you this worked perfectly.
Copy link to clipboard
Copied
Do you want the "Total Funding Request" to be 1/2 of the "Total Cost" with a maximum of $5000?
Copy link to clipboard
Copied
Yes that is exactly what I want.
Copy link to clipboard
Copied
Hi experts,
I have a simple request to get the % increase to be stated in %'s from two columns from the year 2022 to year 2023 columns
thanks
Copy link to clipboard
Copied
You should start a new discussion specific to your question.