Copy link to clipboard
Copied
Hello,
I'm having some troubles with calculating something (This is for a DnD pdf).
I have already gotten loads of scripts working, but my big trouble is when I have a Custom Calculation Script that is dependent upon another Custom Calculation Script to calculate a number...
Let's assume I have:
a) A user input field, called "Dexterity". (Could store the value: 16)
b) Is a Custom Calcution Script (Let's call it "Modifier" that depends on "Dexterity",
to calculate its value. (("DEX" - 10) / 2) (Calculated would be: 3)
My script (Simplified) would be:
event.value = (this.getField("Dexterity").value - 10) / 2;
c) A field (Let's call it "Stealth") that calculates a total value from the "Modifier"
and another User Input Field. (Such as above value + 2 from the User Input Field, total: 5)
My script (Simplified) would be:
event.value = this.getField("Modifier").value + this.getField("NewUserInput").value;
The problem here is c) ("Stealth")
It simply will not calculate it, if it's based on another calculation script ("Modifier"), but will do it, if I use the code from the b) ("Modifier") calculation.
This would not be a problem, of course, except for the fact that I might have an additional changes to the value of "Modifier" based on something different in the sheet´.
I hoped this would work, so it calculate everything very dynamically and nice, but this problem has stumped me for the last 5-6 hours, and I simply don't know what to google to see if anyone has the same problem as me..
Thanks in advance!
Best Regards.
Copy link to clipboard
Copied
Check the calculation order.
Copy link to clipboard
Copied
I don't completely understand what you mean?
Can you give me an example of what you are trying to say, or an example where you calculate something from another calculation field, so I know it's possible?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Okay, perfect. Thank you very much for that, I had no idea what to search for
Is there a way to force a "refresh" of calculated values, when an input changes (Such as when you select a value using a dropdown box).
Currently I need to press a checkbox, for example, before all the values will calculate.
Copy link to clipboard
Copied
Usually all calculations are refreshed when one changes and field used in a calculation and exits the changed field. You should be able to click any place on the form page and all the calculations should refresh.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now