Copy link to clipboard
Copied
I have Acrobat Pro 2020 and finishing with creating a form, but, of course, I am running into a problem 🙂
I have 4 variables: Gender, Conclusion1, Conclusion2, and Percentage
Gender results in a 1 for female and 2 for male
Conclusion1 has already been calculated based on female-related percentage scores derived from total items selected as yes
Conclusion2 has already been calculated based on male-related percentage scores derived from total items selected as yes
I am trying to write code for the Percentage variable that will basically say "if gender = 1, then display the results from the variable Conclusion1; and f gender = 2, then display the results from the variable Conclusion2
Ideas on writing this code?
Copy link to clipboard
Copied
You can use this code as the custom calculation script of the percentage score field:
var gender = this.getField("Gender").valueAsString;
if (gender=="1" ) event.value = this.getField("Conclusion1").valueAsString;
else if (gender=="2" ) event.value = this.getField("Conclusion2").valueAsString;
else event.value = "";
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Thanks for your help!
This works great; however, as I change the number of yes responses, Conclusion1 and Conclusion2 update correctly, but the Percentage field changes to other weird numbers?
Copy link to clipboard
Copied
As I responded above, this works great; however, as I change the number of yes responses, Conclusion1 and Conclusion2 update correctly, but the Percentage field changes to other weird numbers? When I select a different gender and then go back to the same gender, everything updates correctly. That is also the case if I just selct the other gender. So this Percentage does not update as I add the number of yes responses --- unless I re-enter the Gender?
Copy link to clipboard
Copied
Change the field calculation order.