Copy link to clipboard
Copied
I'm developing a form that has a grading section where someone selects a dropdown grade of N/A or 1 to 5 per item. If the option N/A is selected then the export value would then equal "-". These selected values are then populated in a table in column1. In column2 the values are determined by a set of 3 radio buttons.
Sometimes an item is not applicable so it needs to be null and therefore wouldn't need a value in column2.
This is what I need to determine:
If
Item1 is >= 1 AND Radio1 is "YES"
then
Column2 value =="4"
or
If
Item1 is >= 1 AND Radio2 is YES
then
Column2 value =="3"
or
Item1 is >= 1 AND Radio3 is YES then
Column2 value =="5"
else
Column2 value ==null
I've been trying to hunt down the javascript reference to write all this but I've been hitting a lot of roadblocks. Can anyone help me out? Once I have a decent amount of script to go off of I can usually make the necessary adjustments to fit my needs. Any help would be greatly appreciated!
Copy link to clipboard
Copied
You've found a clever solution.
Here is the additon for Item1, assuming that is the actual field name.
if(this.getField("Item1").value != "-")
event.value = oVals[getField("RadioSet").valueAsString];
else
event.value = "";
Copy link to clipboard
Copied
I've applied this custom calculation script to the field in column2. It works really well but not exactly what I need.
ar oVals = {
"Off" : "",
"Radio1" : 4,
"Radio2" : 5,
"Radio3" : 3,
};
event.value = oVals[getField("RadioSet").valueAsString];
How do I get the calculation to also factor if item1 is equal to or greater than 1 then run the script or else the column2 field stays blank?
Copy link to clipboard
Copied
What are you try to achive?
Colun2 id one field?
Dropdown field have values "-","1","2","3","4","5" so what is "Item1"?
Why use radio buttons if you are not making them mutually exclusive, you can use checkboxes instead.
Copy link to clipboard
Copied
I've created a basic example that is a simplified version. My form has many more items(playground equipment).
The value gets adjusted based on the type of area. There is a possibility that one of the items doesn't exist in the area and therefore would not require a calculation. I haven't finished scripting the rest of the table.
https://drive.google.com/file/d/1W43q_sSUzXUGV9de6jAtBgWu_vPRL-JA/view?usp=sharing
Copy link to clipboard
Copied
You've found a clever solution.
Here is the additon for Item1, assuming that is the actual field name.
if(this.getField("Item1").value != "-")
event.value = oVals[getField("RadioSet").valueAsString];
else
event.value = "";
Copy link to clipboard
Copied
Thank you Thom! Do I apply this to the beginning of the custom calculation?
if(this.getField("Item1").value != "-")
event.value = oVals[getField("RadioSet").valueAsString];
else
event.value = "";
ar oVals = {
"Off" : "",
"Radio1" : 4,
"Radio2" : 5,
"Radio3" : 3,
};
event.value = oVals[getField("RadioSet").valueAsString];
Copy link to clipboard
Copied
Oops, I had an extra line. It works adding to what you provided Thom in the custom calculation:
if(this.getField("Item1").value != "-")
event.value = oVals[getField("RadioSet").valueAsString];
else
event.value = "";
ar oVals = {
"Off" : "",
"Radio1" : 4,
"Radio2" : 5,
"Radio3" : 3,
};
Copy link to clipboard
Copied
The oVals definition needs to be the first thing in the script, followed by the "if" condition and calculation.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more