I have a question about inputting a formula (java script) into a pdf form.
This is the calculation:
If the inherent risk exposure is 25 and we indicate risk mitigation strategies to be “Strong”, the residual risk exposure should read 16. And so on…
Is it possible to produce a script for this formula?
I am using a combination of text and dropdown, but dropdown is preferable.
I would need assistance how to set that up. Thank you.
So the resulting risk is acquired from a table? Then you'll need to create the table as an Array. Then the values from the two dropdowns are used to create the indexes that access the table. Since they are already numbers you're pretty well setup for this
Here's an example
var aRiskExposure = [ [0,0,0],
[0,12, 15, 30],
I have seven rows in each column (inherent risk, mitigation strategy and residual risk).
In each row for example:
If inherent risk is 5 and mitigation strategy is strong, residual risk is 3.
Each row will have 52 options depending on the inherent risk result and the risk mitigation strategy used.
So, the strategy I proposed will work. Just build your table with arrays, then use the selected values to index into the array. I you need help with this I provide private consulting/training sessions. Contact me through the www.pdfscripting.com site.
I was hoping to obtain this information via forum, as I used to previously. I just need assistance in setting the formula up. Thank you.
So I already provided you with a winning strategy. But if you need more details, Then
The first part is to recreate your table as an array, as I showed in the first post.
Then, on the dropdowns for your two selectors, inherent risk and mitigation strategy, provide export values that are integers, unless they are already integers.
Then use these two values to select a "residual risk" value from the table.
For example, use this code in a calculation script on the residual risk field
event.value = aResidualRisk[this.getField("inherent risk".value][this.getField("mitigation strategy")];
Thank you for your reply. I am getting a syntax error when entering - so I must be doing something wrong. Are you able to provide me with additional information on how to build a table as an array?
Here's the fixed code:
event.value = aResidualRisk[this.getField("inherent risk").value][this.getField("mitigation strategy")];
Not trying to be rude, yet you are. Thank you for everything so far. I will take care of it from here.