We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.
I am needing help with a calculation on one of the Acrobat forms I am working on. It is for an electrical company to use when removing and installing meters. Basically what I need help with is as below:
Or would it be better if I just make the ratio into two dropdown boxes so that the calculation can take that second figure of the ratio directly from the separate dropdown menu?
Thanks in advance!
You can use 'split' to get number after '/'.
Lets say dropdown field is named "Ratio", you can use something like this:
var cRatio = this.getField("Ratio").valueAsString.split("/")
var num = cRatio;
In your example (100/5) variable 'num' will be 5 and you can use 'num' in your calculation.
Also in dropdown field properties under 'options' tab check 'Commit selected value immediately'.
That first part worked perfectly thank you! Now I'm just trying to work it into my calculation.
The calculation is for Calculated VA@full-load: CT Secondary Current Max X Secondary Current Max X CT-Impedance Z. (Also known as: num X num X Calc3.0)
ComboBox6 is the dropdown field that I get the ratio from.
Don't call "num" as field it's variable , event.value = num*num*f2.value; should be enough.
Just watch for NaN, if you have blank as option in dropdown field use like this:
var drop = this.getField("ComboBox6").valueAsString;
var cComboBox6 = drop.split("/");
var num = cComboBox6;
var f2 = Number(this.getField("Calc3.0").value);
if(f2 == "" || drop == " ")
event.value = "";
else event.value = num*num*f2;
Thank you Nesa! You're a life saver 🙂 It worked perfectly.
Have a great day!
You could also set the export value of each item in the dropdown to the corresponding number you want to use for each item. If some item export values might be the same numerically, set the export values so they're unique as strings (e.g., "5", "5.0", "5.00", etc). You'd probably only do this sort of thing if you're not going to be extracting/exporting the form data in some manner.
Unfortunately the client will be exporting all the data from this PDF so that method may not work. Thank you for your input though!