Or can this even be done? I am new to using Java in Acrobat and would appreciate any feedback
You may need to elaborate if this answer doesn't help; I really have no idea what you're asking for exactly.
I suspect you want to use the value of the dropdown in a calculation that is in a different field. In that case, just use basic math in your calculation. In your dropdown, just set the last two values to negative numbers.
Hello Joel, thanks for your reply.
I have a specific field that has a drop down menu with 5 options (Obligation ,Invoice, Manual Adjustment, Manual Transfer and Set Complete) to select. I am trying to create a script that if 1-3 options were selected then it would add two fields (Current Obligation, Cumulative Obligation). If the last two are selected then it would subtract two fields (Current Obligation, Cumulative Obligation). Hope this clear things up a bit.
Order matters in subtraction so I'm assuming "subtract two fields (Current Obligation, Cumulative Obligation)" means subtract Current Obligation FROM Cumulative Obligation.
It seems like you think you need to branch your code based on the selection in the list. You don't. You just need to be clever in how you set the values.
In your dropdown, your item names will be your list of five. For the first three export values, you'll enter the number 1. For the last two, enter -1.
You don't supply the actual field names so I have to do this in pseudo code but... your calculation is...
Cumulative Obligation + (Current Obligation * ValueOfYourDropdownField);
Assuming Current Obligation is always positive, when it gets multiplied by the value of the dropdown AND the dropdown value is one of the last two, the value becomes negative and added to the Cumulative Obligation which, effectively, subtracts it. When any of the first three in the list is selected, the number doesn't change and it just gets added.