Copy link to clipboard
Copied
I am trying to create a formula that calculates several fields in exponential growth but have yet to find the right syntax. Please help!
Value = A x (1 + B)^C
Copy link to clipboard
Copied
event.value = A * Math.pow(1+(B/100), C);
Copy link to clipboard
Copied
Value = D and it is a read-only, will only input values of A, B and C
Copy link to clipboard
Copied
This is the Using the Community forum (which is the forum for issues using the forums).
Please tell us what Adobe application you are using so that this can be moved to the proper forum for help.
Copy link to clipboard
Copied
Oh thank you! Adobe Acrobat 😉
Copy link to clipboard
Copied
You need a script. Try this:
var A = Number(this.getField("A").valueAsString);
var B = Number(this.getField("B").valueAsString);
var C = Number(this.getField("C").valueAsString);
event.value = A * Math.pow(1+B, C);
Copy link to clipboard
Copied
Hello! This helped TREMENDOUSLY, thank you! Our field 'B' is a %... so sometimes the numbers get a little wonky if they aren't inputed as '0.00' vs. 'x%'... any clue how to combat that?
Copy link to clipboard
Copied
Not sure what you mean, but if it's a Percentage field you need to enter the values between 0 and 1.
If you want the field to accept values between 0 and 100 then set the Format to Custom and apply the following code as the custom Format script:
if (event.value) event.value+="%";
Copy link to clipboard
Copied
Hi! Thank you so much. Here is my hang-up. The value 'B' is entered as a percentage, i.e. '10.5%' but then the formula doesn't compute correctly. In the formula, it needs to correct '10.5' to '0.105' to work correctly. Do you know how to create a script that would correct that? See snip below...
Copy link to clipboard
Copied
Divide the R-value by 100.
Copy link to clipboard
Copied
You have been so kind and patient... helping a newbie out (lol)... where do I insert /100? I've tried it in the field for the percentage but also in the cumulating field and neither are yielding the correct answer.
Copy link to clipboard
Copied
event.value = A * Math.pow(1+(B/100), C);
Copy link to clipboard
Copied
Thank you SO incredibly much. You have been so helpful! This worked 😉
Find more inspiration, events, and resources on the new Adobe Community
Explore Now