Copy link to clipboard
Copied
Can I set up a formula or script that runs off of a lookup table to complete these? For example. From the first drop-down you select the color blue, the second drop-down you select 25, then in the third box it auto fills "apple". Like the table below, the result is based on checking the first and second columns to determine the output in the third.
| Color | Number | Word |
|---|---|---|
| Blue | 25 | Apple |
| Red | 16 | Orange |
| Blue | 16 | Peach |
| Red | 25 | Pineapple |
I'm thinking that when I do the third field I'd use a loop script for the calculation.
(I don't know any javascript yet)
if (Box Color = Blue)
if (Box Number =25)
then Box result = Word
else if (Box Number =16)
then Box result = Peach
else if (Box Color = Red)
if (Box Number = 25)
then Box result = Pineapple
else if (Box Number = 16)
then Box result = Orange
else Box result = " "
Is this along the right lines? Or is there a better way? Considering the data tables I'm using are more extensive than the example above.
Copy link to clipboard
Copied
Since this is not a calculation, you are correct that the values need to be hard coded. You could create an "if" coding structure such as one you have above, but my preferred solution is to organize the data into a structure where the two choices automatically select for the correct value.
For Example:
var valueList = {"Blue":{"25":"Apple","16":"Peach"},
""Red":{"25":"Pineapple","16":"Orange"}
}
Then value selection is just a matter of selecting from the list.
var email = valueList[ this.getField("DropDown1") ][ this.getField("DropDown2") ];
Copy link to clipboard
Copied
Since this is not a calculation, you are correct that the values need to be hard coded. You could create an "if" coding structure such as one you have above, but my preferred solution is to organize the data into a structure where the two choices automatically select for the correct value.
For Example:
var valueList = {"Blue":{"25":"Apple","16":"Peach"},
""Red":{"25":"Pineapple","16":"Orange"}
}
Then value selection is just a matter of selecting from the list.
var email = valueList[ this.getField("DropDown1") ][ this.getField("DropDown2") ];
Copy link to clipboard
Copied
That definitely looks much better than what I had in mind. I was just informed that I need to account for another variable that I wasn't expecting.
Blue - 25 - Rectangle - Apple
Blue - 25 - Square - Grape
For the primary or first value there are only two options, for the second there are 6 but the third has about 25. So could I write it the same?
var valueList = {"Blue":{"25":{"Rectangle":"Apple","Square":"Grape","Circle":"Starfruit"},"16":{...
then selecting from the list
var email = valueList[this.getField("DropDown1")][this.getField("DropDown2")][this.getField("DropDown3")];
Would that work? I'm going to give it a shot in the morning. Hopefully my understanding of programming and how lists work isn't failing me.
Copy link to clipboard
Copied
As long as the brackets all line up correctly you can nest it as much as you'd like. If you format it well, it makes it easy to add, remove, and modify entries.
Copy link to clipboard
Copied
If I wanted to say that if something is "Blue" and the next value is anything greater than 25 it would all be a specific variable, how would I write that into the list?
var valueList = {"Blue":{"25":{"Rectangle":"Apple"},>"25"{"Diamond":"Pear"}...
Will it let me do a greater than function or would I need to identify every possible option above 25, or possible below the smallest number?
Copy link to clipboard
Copied
Of course you don't need to specify any option above 25 (there's an infinite amount of them, anyway), but you also can't use this logic to do it like that. It would require a much more complex script.
Copy link to clipboard
Copied
I'll just enter the values manually into the current script format. The issue I'm now running into is the actual execution of the script. When I input the values into the designated drop-downs it doesn't populate the field that the script is associated with. I've tried putting the script in the Custom Calculate box as well as the action box. Neither of those options run the script. Am I missing something?
Copy link to clipboard
Copied
You need to apply the value to the event, like this:
event.value = email;
Copy link to clipboard
Copied
So, here is the code I have so far.
var valueList={"Male":{"17":{"1":"3","2":"5","3":"6","4":"8","5":"9","6":"10","7":"12","8":"13","9":"14","10":"16","11":"17","12":"19","13":"20","14":"21","15":"23","16":"24","17":"26","18":"27","19":"28","20":"30","21":"31","22":"32","23":"34","24":"35","25":"37","26":"38","27":"39","28":"41","29":"42","30":"43","31":"45","32":"46","33":"48","34":"49","35":"50","36":"52","37":"53","38":"54","39":"56","40":"57","41":"59","42":"60","43":"61","44":"63","45":"64","46":"66","47":"67","48":"68","49":"70","50":"71","51":"72","52":"74","53":"75","54":"77","55":"78","56":"79","57":"81","58":"82","59":"83","60":"85","61":"88","62":"88","63":"89","64":"90","65":"92","66":"93","67":"94","68":"96","69":"97","70":"99","71":"100"},..."41":{"1":"26","2":"27","3":"28","4":"29","5":"30","6":"31","7":"32","8":"33","9":"34","10":"35","11":"36","12":"37","13":"38","14":"39","15":"41","16":"42","17":"43","18":"44","19":"45","20":"46","21":"47","22":"48","23":"49","24":"50","25":"51","26":"52","27":"53","28":"54","29":"55","30":"56","31":"57","32":"58","33":"59","34":"60","35":"61","36":"62","37":"63","38":"64","39":"65","40":"66","41":"67","42":"68","43":"69","44":"70","45":"71","46":"72","47":"73","48":"74","49":"75","50":"76","51":"77","52":"78","53":"79","54":"81","55":"82","56":"83","57":"84","58":"85","59":"86","60":"87","61":"88","62":"89","63":"90","64":"91","65":"92","66":"93","67":"94","68":"95","69":"96","70":"97","71":"98","72":"99","73":"100"}},"Female":{"17":{"1":"29","2":"30","3":"32","4":"34","5":"36","6":"37","7":"39","8":"41","9":"43","10":"44","11":"46","12":"48","13":"50","14":"51","15":"53","16":"55","17":"57","18":"58","19":"60","20":"62","21":"63","22":"65","23":"67","24":"69","25":"70","26":"72","27":"74","28":"76","29":"77","30":"79","31":"81","32":"83","33":"84","34":"86","35":"88","36":"90","37":"91","38":"93","39":"95","40":"97","41":"98","42":"100"},....,"31":{"1":"41","2":"42","3":"43","4":"44","5":"45","6":"47","7":"48","8":"49","9":"49","10":"50","11":"52","12":"54","13":"55","14":"56","15":"58","16":"59","17":"60","18":"61","19":"62","20":"64","21":"65","22":"66","23":"67","24":"68","25":"70","26":"71","27":"72","28":"73","29":"75","30":"76","31":"77","32":"88","33":"79","34":"81","35":"82","36":"83","37":"84","38":"85","39":"87","40":"88","41":"89","42":"90","43":"92","44":"93","45":"94","46":"95","47":"96","48":"98","49":"99","50":"100"}}};
var score1=valueList[this.getField("Gender")][this.getField("Age1")][this.getField("PuRaw1")];
Where to do put "event.value=score1;"?
With the rest of the code? Then where do I put the entire code in adobe? The Custom Script, Action, or validate?
Copy link to clipboard
Copied
- As the last line of the code.
- Use it as the custom calculation script of your field.
- This line seems wrong:
var score1=valueList[this.getField("Gender")][this.getField("Age1")][this.getField("PuRaw1")] ;
It should probably be:
var score1=valueList[this.getField("Gender").valueAsString][this.getField("Age1").valueAsString][this.getField("PuRaw1").valueAsString] ;
Copy link to clipboard
Copied
I my last two lines look like this.
var score1=valueList[this.getField("Gender").valueAsString][this.getField("Age1").valueAsString][this.getField("PuRaw1").valueAsString];
event.value=score1;
I'm using score1 as the variable as that is the box in which it will be displayed. I went through and selected "Male" from the first drop-down ("Gender"), then selected 18 from the second ("Age1") and then 65 from ("PuRaw1"). Nothing appeared in "score1". I tabbed over to it and past it, then manually clicked that box. It still isn't filling.
Copy link to clipboard
Copied
Check the JS Console (Ctrl+J) for error messages.
On 5 December 2017 at 17:07, stevene30137170 <forums_noreply@adobe.com>
Copy link to clipboard
Copied
TypeError: valueList[this.getField(...).valueAsString][this.getField(...).valueAsString] is undefined
42:Field:Calculate
TypeError: valueList[this.getField(...).valueAsString] is undefined
42:Field:Calculate
TypeError: valueList[this.getField(...).valueAsString] is undefined
42:Field:Calculate
TypeError: valueList[this.getField(...).valueAsString] is undefined
42:Field:Calculate
TypeError: valueList[this.getField(...).valueAsString][this.getField(...).valueAsString] is undefined
42:Field:Calculate
TypeError: valueList[this.getField(...).valueAsString][this.getField(...).valueAsString] is undefined
42:Field:Calculate
InvalidSetError: Set not possible, invalid or unknown.
Event.value:44:Field Score1:Calculate
InvalidSetError: Set not possible, invalid or unknown.
Event.value:44:Field SCORE1:Calculate
InvalidSetError: Set not possible, invalid or unknown.
Event.value:5:Field Score1:Calculate
That is what the console showed.
Copy link to clipboard
Copied
More specifically. I cleared the console and reset all of the selections.
When I selected first "Male", then "17", then "1" from their corresponding drop-downs, this is what displayed in the console.
TypeError: valueList[this.getField(...).valueAsString][this.getField(...).valueAsString] is undefined
3:Field:Calculate
TypeError: valueList[this.getField(...).valueAsString][this.getField(...).valueAsString] is undefined
42:Field:Calculate
InvalidSetError: Set not possible, invalid or unknown.
Event.value:5:Field Score1:Calculate
InvalidSetError: Set not possible, invalid or unknown.
Event.value:44:Field SCORE1:Calculate
Copy link to clipboard
Copied
You need to add a condition to only look up the value in the valueList if
the fields are filled-in.
On 5 December 2017 at 17:25, stevene30137170 <forums_noreply@adobe.com>
Copy link to clipboard
Copied
Do you mean to wrap the whole thing up in an if statement?
if "Gender" value = true && "Age1" value = true && "PuRaw1" value = true
then execute the script, otherwise do nothing?
How would I tell it to identify with the appropriate values. For the first selection I have 3 options. " ", "Male", and "Female". I have the " " so that when nothing is selected the field will remain blank.
Would it be easier to write the if statement based on the value of the fields = " " to not run the script and have the else run the script?
//build the list here
if(Gender=" "&&Age1=" "&&PuRaw1=" ")
{
event.value=" ";
}
else
{
event.value=Score1;
};
Copy link to clipboard
Copied
No quite. Use this instead:
// define the variables here
if (Gender==" " || Age1=" " || PuRaw1=" ") {
event.value=" ";
} else {
// put the rest of the code here
}
Copy link to clipboard
Copied
I defined the variables for Gender, Age1, PuRaw1, and Score1 all as string. Now it's giving a syntax error.
if(Gender==" "||Age1==" "||PuRaw1==" ")
{ event.value=" ";} Syntax Error: syntax error 6
else{
//rest of code here
}
Why is that popping up?
Copy link to clipboard
Copied
Post the full code.
On 5 December 2017 at 19:37, stevene30137170 <forums_noreply@adobe.com>
Copy link to clipboard
Copied
var Gender=string;
var Age1=string;
var PuRaw1=string;
var Score1=string;
if(Gender==" "||Age1==" "||PuRaw1==" ")
{
event.value=" ";
}
else{
var valueList = {"Male":{"17":{"1":"3","2":"5","3":"6","4":"8","5":"9","6":"10","7":"12","8":"13","9":"14","10":"16","11":"17","12":"19","13":"20","14":"21","15":"23","16":"24","17":"26","18":"27","19":"28","20":"30","21":"31","22":"32","23":"34","24":"35","25":"37","26":"38","27":"39","28":"41","29":"42","30":"43","31":"45","32":"46","33":"48","34":"49","35":"50","36":"52","37":"53","38":"54","39":"56","40":"57","41":"59","42":"60","43":"61","44":"63","45":"64","46":"66","47":"67","48":"68","49":"70","50":"71","51":"72","52":"74","53":"75","54":"77","55":"78","56":"79","57":"81","58":"82","59":"83","60":"85","61":"88","62":"88","63":"89","64":"90","65":"92","66":"93","67":"94","68":"96","69":"97","70":"99","71":"100"},
"18":{"1":"3","2":"5","3":"6","4":"8","5":"9","6":"10","7":"12","8":"13","9":"14","10":"16","11":"17","12":"19","13":"20","14":"21","15":"23","16":"24","17":"26","18":"27","19":"28","20":"30","21":"31","22":"32","23":"34","24":"35","25":"37","26":"38","27":"39","28":"41","29":"42","30":"43","31":"45","32":"46","33":"48","34":"49","35":"50","36":"52","37":"53","38":"54","39":"56","40":"57","41":"59","42":"60","43":"61","44":"63","45":"64","46":"66","47":"67","48":"68","49":"70","50":"71","51":"72","52":"74","53":"75","54":"77","55":"78","56":"79","57":"81","58":"82","59":"83","60":"85","61":"88","62":"88","63":"89","64":"90","65":"92","66":"93","67":"94","68":"96","69":"97","70":"99","71":"100"},
"19":{"1":"3","2":"5","3":"6","4":"8","5":"9","6":"10","7":"12","8":"13","9":"14","10":"16","11":"17","12":"19","13":"20","14":"21","15":"23","16":"24","17":"26","18":"27","19":"28","20":"30","21":"31","22":"32","23":"34","24":"35","25":"37","26":"38","27":"39","28":"41","29":"42","30":"43","31":"45","32":"46","33":"48","34":"49","35":"50","36":"52","37":"53","38":"54","39":"56","40":"57","41":"59","42":"60","43":"61","44":"63","45":"64","46":"66","47":"67","48":"68","49":"70","50":"71","51":"72","52":"74","53":"75","54":"77","55":"78","56":"79","57":"81","58":"82","59":"83","60":"85","61":"88","62":"88","63":"89","64":"90","65":"92","66":"93","67":"94","68":"96","69":"97","70":"99","71":"100"},
"20":{"1":"3","2":"5","3":"6","4":"8","5":"9","6":"10","7":"12","8":"13","9":"14","10":"16","11":"17","12":"19","13":"20","14":"21","15":"23","16":"24","17":"26","18":"27","19":"28","20":"30","21":"31","22":"32","23":"34","24":"35","25":"37","26":"38","27":"39","28":"41","29":"42","30":"43","31":"45","32":"46","33":"48","34":"49","35":"50","36":"52","37":"53","38":"54","39":"56","40":"57","41":"59","42":"60","43":"61","44":"63","45":"64","46":"66","47":"67","48":"68","49":"70","50":"71","51":"72","52":"74","53":"75","54":"77","55":"78","56":"79","57":"81","58":"82","59":"83","60":"85","61":"88","62":"88","63":"89","64":"90","65":"92","66":"93","67":"94","68":"96","69":"97","70":"99","71":"100"},
"21":{"1":"3","2":"5","3":"6","4":"8","5":"9","6":"10","7":"12","8":"13","9":"14","10":"16","11":"17","12":"19","13":"20","14":"21","15":"23","16":"24","17":"26","18":"27","19":"28","20":"30","21":"31","22":"32","23":"34","24":"35","25":"37","26":"38","27":"39","28":"41","29":"42","30":"43","31":"45","32":"46","33":"48","34":"49","35":"50","36":"52","37":"53","38":"54","39":"56","40":"57","41":"59","42":"60","43":"61","44":"63","45":"64","46":"66","47":"67","48":"68","49":"70","50":"71","51":"72","52":"74","53":"75","54":"77","55":"78","56":"79","57":"81","58":"82","59":"83","60":"85","61":"88","62":"88","63":"89","64":"90","65":"92","66":"93","67":"94","68":"96","69":"97","70":"99","71":"100"},
"22":{"1":"15","2":"17","3":"18","4":"19","5":"20","6":"21","7":"22","8":"23","9":"25","10":"26","11":"27","12":"28","13":"29","14":"30","15":"31","16":"33","17":"34","18":"35","19":"36","20":"37","21":"38","22":"39","23":"41","24":"42","25":"43","26":"44","27":"45","28":"46","29":"47","30":"49","31":"50","32":"51","33":"52","34":"53","35":"54","36":"55","37":"57","38":"58","39":"59","40":"60","41":"61","42":"62","43":"63","44":"65","45":"66","46":"67","47":"68","48":"69","49":"70","50":"71","51":"73","52":"74","53":"75","54":"76","55":"77","56":"78","57":"79","58":"81","59":"82","60":"83","61":"84","62":"85","63":"86","64":"87","65":"89","66":"90","67":"91","68":"92","69":"93","70":"94","71":"96","72":"97","73":"98","74":"99","75":"100"},
"23":{"1":"15","2":"17","3":"18","4":"19","5":"20","6":"21","7":"22","8":"23","9":"25","10":"26","11":"27","12":"28","13":"29","14":"30","15":"31","16":"33","17":"34","18":"35","19":"36","20":"37","21":"38","22":"39","23":"41","24":"42","25":"43","26":"44","27":"45","28":"46","29":"47","30":"49","31":"50","32":"51","33":"52","34":"53","35":"54","36":"55","37":"57","38":"58","39":"59","40":"60","41":"61","42":"62","43":"63","44":"65","45":"66","46":"67","47":"68","48":"69","49":"70","50":"71","51":"73","52":"74","53":"75","54":"76","55":"77","56":"78","57":"79","58":"81","59":"82","60":"83","61":"84","62":"85","63":"86","64":"87","65":"89","66":"90","67":"91","68":"92","69":"93","70":"94","71":"96","72":"97","73":"98","74":"99","75":"100"},
"24":{"1":"15","2":"17","3":"18","4":"19","5":"20","6":"21","7":"22","8":"23","9":"25","10":"26","11":"27","12":"28","13":"29","14":"30","15":"31","16":"33","17":"34","18":"35","19":"36","20":"37","21":"38","22":"39","23":"41","24":"42","25":"43","26":"44","27":"45","28":"46","29":"47","30":"49","31":"50","32":"51","33":"52","34":"53","35":"54","36":"55","37":"57","38":"58","39":"59","40":"60","41":"61","42":"62","43":"63","44":"65","45":"66","46":"67","47":"68","48":"69","49":"70","50":"71","51":"73","52":"74","53":"75","54":"76","55":"77","56":"78","57":"79","58":"81","59":"82","60":"83","61":"84","62":"85","63":"86","64":"87","65":"89","66":"90","67":"91","68":"92","69":"93","70":"94","71":"96","72":"97","73":"98","74":"99","75":"100"},
"25":{"1":"15","2":"17","3":"18","4":"19","5":"20","6":"21","7":"22","8":"23","9":"25","10":"26","11":"27","12":"28","13":"29","14":"30","15":"31","16":"33","17":"34","18":"35","19":"36","20":"37","21":"38","22":"39","23":"41","24":"42","25":"43","26":"44","27":"45","28":"46","29":"47","30":"49","31":"50","32":"51","33":"52","34":"53","35":"54","36":"55","37":"57","38":"58","39":"59","40":"60","41":"61","42":"62","43":"63","44":"65","45":"66","46":"67","47":"68","48":"69","49":"70","50":"71","51":"73","52":"74","53":"75","54":"76","55":"77","56":"78","57":"79","58":"81","59":"82","60":"83","61":"84","62":"85","63":"86","64":"87","65":"89","66":"90","67":"91","68":"92","69":"93","70":"94","71":"96","72":"97","73":"98","74":"99","75":"100"},
"26":{"1":"15","2":"17","3":"18","4":"19","5":"20","6":"21","7":"22","8":"23","9":"25","10":"26","11":"27","12":"28","13":"29","14":"30","15":"31","16":"33","17":"34","18":"35","19":"36","20":"37","21":"38","22":"39","23":"41","24":"42","25":"43","26":"44","27":"45","28":"46","29":"47","30":"49","31":"50","32":"51","33":"52","34":"53","35":"54","36":"55","37":"57","38":"58","39":"59","40":"60","41":"61","42":"62","43":"63","44":"65","45":"66","46":"67","47":"68","48":"69","49":"70","50":"71","51":"73","52":"74","53":"75","54":"76","55":"77","56":"78","57":"79","58":"81","59":"82","60":"83","61":"84","62":"85","63":"86","64":"87","65":"89","66":"90","67":"91","68":"92","69":"93","70":"94","71":"96","72":"97","73":"98","74":"99","75":"100"},
"27":{"1":"20","2":"21","3":"22","4":"23","5":"24","6":"25","7":"26","8":"27","9":"28","10":"29","11":"31","12":"32","13":"33","14":"34","15":"35","16":"36","17":"37","18":"38","19":"39","20":"40","21":"41","22":"42","23":"43","24":"44","25":"45","26":"46","27":"47","28":"48","29":"49","30":"50","31":"52","32":"53","33":"54","34":"55","35":"56","36":"57","37":"58","38":"59","39":"60","40":"61","41":"62","42":"63","43":"64","44":"65","45":"66","46":"67","47":"68","48":"69","49":"71","50":"72","51":"73","52":"74","53":"75","54":"76","55":"77","56":"78","57":"79","58":"80","59":"81","60":"82","61":"83","62":"84","63":"85","64":"86","65":"87","66":"88","67":"89","68":"91","69":"92","70":"93","71":"94","72":"95","73":"96","74":"97","75":"98","76":"99","77":"100"},
"28":{"1":"20","2":"21","3":"22","4":"23","5":"24","6":"25","7":"26","8":"27","9":"28","10":"29","11":"31","12":"32","13":"33","14":"34","15":"35","16":"36","17":"37","18":"38","19":"39","20":"40","21":"41","22":"42","23":"43","24":"44","25":"45","26":"46","27":"47","28":"48","29":"49","30":"50","31":"52","32":"53","33":"54","34":"55","35":"56","36":"57","37":"58","38":"59","39":"60","40":"61","41":"62","42":"63","43":"64","44":"65","45":"66","46":"67","47":"68","48":"69","49":"71","50":"72","51":"73","52":"74","53":"75","54":"76","55":"77","56":"78","57":"79","58":"80","59":"81","60":"82","61":"83","62":"84","63":"85","64":"86","65":"87","66":"88","67":"89","68":"91","69":"92","70":"93","71":"94","72":"95","73":"96","74":"97","75":"98","76":"99","77":"100"},
"29":{"1":"20","2":"21","3":"22","4":"23","5":"24","6":"25","7":"26","8":"27","9":"28","10":"29","11":"31","12":"32","13":"33","14":"34","15":"35","16":"36","17":"37","18":"38","19":"39","20":"40","21":"41","22":"42","23":"43","24":"44","25":"45","26":"46","27":"47","28":"48","29":"49","30":"50","31":"52","32":"53","33":"54","34":"55","35":"56","36":"57","37":"58","38":"59","39":"60","40":"61","41":"62","42":"63","43":"64","44":"65","45":"66","46":"67","47":"68","48":"69","49":"71","50":"72","51":"73","52":"74","53":"75","54":"76","55":"77","56":"78","57":"79","58":"80","59":"81","60":"82","61":"83","62":"84","63":"85","64":"86","65":"87","66":"88","67":"89","68":"91","69":"92","70":"93","71":"94","72":"95","73":"96","74":"97","75":"98","76":"99","77":"100"},
"30":{"1":"20","2":"21","3":"22","4":"23","5":"24","6":"25","7":"26","8":"27","9":"28","10":"29","11":"31","12":"32","13":"33","14":"34","15":"35","16":"36","17":"37","18":"38","19":"39","20":"40","21":"41","22":"42","23":"43","24":"44","25":"45","26":"46","27":"47","28":"48","29":"49","30":"50","31":"52","32":"53","33":"54","34":"55","35":"56","36":"57","37":"58","38":"59","39":"60","40":"61","41":"62","42":"63","43":"64","44":"65","45":"66","46":"67","47":"68","48":"69","49":"71","50":"72","51":"73","52":"74","53":"75","54":"76","55":"77","56":"78","57":"79","58":"80","59":"81","60":"82","61":"83","62":"84","63":"85","64":"86","65":"87","66":"88","67":"89","68":"91","69":"92","70":"93","71":"94","72":"95","73":"96","74":"97","75":"98","76":"99","77":"100"},
"31":{"1":"20","2":"21","3":"22","4":"23","5":"24","6":"25","7":"26","8":"27","9":"28","10":"29","11":"31","12":"32","13":"33","14":"34","15":"35","16":"36","17":"37","18":"38","19":"39","20":"40","21":"41","22":"42","23":"43","24":"44","25":"45","26":"46","27":"47","28":"48","29":"49","30":"50","31":"52","32":"53","33":"54","34":"55","35":"56","36":"57","37":"58","38":"59","39":"60","40":"61","41":"62","42":"63","43":"64","44":"65","45":"66","46":"67","47":"68","48":"69","49":"71","50":"72","51":"73","52":"74","53":"75","54":"76","55":"77","56":"78","57":"79","58":"80","59":"81","60":"82","61":"83","62":"84","63":"85","64":"86","65":"87","66":"88","67":"89","68":"91","69":"92","70":"93","71":"94","72":"95","73":"96","74":"97","75":"98","76":"99","77":"100"},
"32":{"1":"24","2":"25","3":"26","4":"27","5":"28","6":"29","7":"31","8":"31","9":"32","10":"33","11":"34","12":"35","13":"36","14":"37","15":"38","16":"39","17":"41","18":"42","19":"43","20":"44","21":"45","22":"46","23":"47","24":"48","25":"49","26":"50","27":"51","28":"52","29":"53","30":"54","31":"55","32":"56","33":"57","34":"58","35":"59","36":"60","37":"61","38":"62","39":"63","40":"64","41":"65","42":"66","43":"67","44":"68","45":"69","46":"70","47":"71","48":"72","49":"73","50":"74","51":"75","52":"76","53":"77","54":"78","55":"79","56":"81","57":"82","58":"83","59":"84","60":"85","61":"86","62":"87","63":"88","64":"89","65":"90","66":"91","67":"92","68":"93","69":"94","70":"95","71":"96","72":"97","73":"98","74":"99","75":"100"},
"33":{"1":"24","2":"25","3":"26","4":"27","5":"28","6":"29","7":"31","8":"31","9":"32","10":"33","11":"34","12":"35","13":"36","14":"37","15":"38","16":"39","17":"41","18":"42","19":"43","20":"44","21":"45","22":"46","23":"47","24":"48","25":"49","26":"50","27":"51","28":"52","29":"53","30":"54","31":"55","32":"56","33":"57","34":"58","35":"59","36":"60","37":"61","38":"62","39":"63","40":"64","41":"65","42":"66","43":"67","44":"68","45":"69","46":"70","47":"71","48":"72","49":"73","50":"74","51":"75","52":"76","53":"77","54":"78","55":"79","56":"81","57":"82","58":"83","59":"84","60":"85","61":"86","62":"87","63":"88","64":"89","65":"90","66":"91","67":"92","68":"93","69":"94","70":"95","71":"96","72":"97","73":"98","74":"99","75":"100"},
"34":{"1":"24","2":"25","3":"26","4":"27","5":"28","6":"29","7":"31","8":"31","9":"32","10":"33","11":"34","12":"35","13":"36","14":"37","15":"38","16":"39","17":"41","18":"42","19":"43","20":"44","21":"45","22":"46","23":"47","24":"48","25":"49","26":"50","27":"51","28":"52","29":"53","30":"54","31":"55","32":"56","33":"57","34":"58","35":"59","36":"60","37":"61","38":"62","39":"63","40":"64","41":"65","42":"66","43":"67","44":"68","45":"69","46":"70","47":"71","48":"72","49":"73","50":"74","51":"75","52":"76","53":"77","54":"78","55":"79","56":"81","57":"82","58":"83","59":"84","60":"85","61":"86","62":"87","63":"88","64":"89","65":"90","66":"91","67":"92","68":"93","69":"94","70":"95","71":"96","72":"97","73":"98","74":"99","75":"100"},
"35":{"1":"24","2":"25","3":"26","4":"27","5":"28","6":"29","7":"31","8":"31","9":"32","10":"33","11":"34","12":"35","13":"36","14":"37","15":"38","16":"39","17":"41","18":"42","19":"43","20":"44","21":"45","22":"46","23":"47","24":"48","25":"49","26":"50","27":"51","28":"52","29":"53","30":"54","31":"55","32":"56","33":"57","34":"58","35":"59","36":"60","37":"61","38":"62","39":"63","40":"64","41":"65","42":"66","43":"67","44":"68","45":"69","46":"70","47":"71","48":"72","49":"73","50":"74","51":"75","52":"76","53":"77","54":"78","55":"79","56":"81","57":"82","58":"83","59":"84","60":"85","61":"86","62":"87","63":"88","64":"89","65":"90","66":"91","67":"92","68":"93","69":"94","70":"95","71":"96","72":"97","73":"98","74":"99","75":"100"},
"36":{"1":"24","2":"25","3":"26","4":"27","5":"28","6":"29","7":"31","8":"31","9":"32","10":"33","11":"34","12":"35","13":"36","14":"37","15":"38","16":"39","17":"41","18":"42","19":"43","20":"44","21":"45","22":"46","23":"47","24":"48","25":"49","26":"50","27":"51","28":"52","29":"53","30":"54","31":"55","32":"56","33":"57","34":"58","35":"59","36":"60","37":"61","38":"62","39":"63","40":"64","41":"65","42":"66","43":"67","44":"68","45":"69","46":"70","47":"71","48":"72","49":"73","50":"74","51":"75","52":"76","53":"77","54":"78","55":"79","56":"81","57":"82","58":"83","59":"84","60":"85","61":"86","62":"87","63":"88","64":"89","65":"90","66":"91","67":"92","68":"93","69":"94","70":"95","71":"96","72":"97","73":"98","74":"99","75":"100"},
"37":{"1":"26","2":"27","3":"28","4":"29","5":"30","6":"31","7":"32","8":"33","9":"34","10":"35","11":"36","12":"37","13":"38","14":"39","15":"41","16":"42","17":"43","18":"44","19":"45","20":"46","21":"47","22":"48","23":"49","24":"50","25":"51","26":"52","27":"53","28":"54","29":"55","30":"56","31":"57","32":"58","33":"59","34":"60","35":"61","36":"62","37":"63","38":"64","39":"65","40":"66","41":"67","42":"68","43":"69","44":"70","45":"71","46":"72","47":"73","48":"74","49":"75","50":"76","51":"77","52":"78","53":"79","54":"81","55":"82","56":"83","57":"84","58":"85","59":"86","60":"87","61":"88","62":"89","63":"90","64":"91","65":"92","66":"93","67":"94","68":"95","69":"96","70":"97","71":"98","72":"99","73":"100"},
"38":{"1":"26","2":"27","3":"28","4":"29","5":"30","6":"31","7":"32","8":"33","9":"34","10":"35","11":"36","12":"37","13":"38","14":"39","15":"41","16":"42","17":"43","18":"44","19":"45","20":"46","21":"47","22":"48","23":"49","24":"50","25":"51","26":"52","27":"53","28":"54","29":"55","30":"56","31":"57","32":"58","33":"59","34":"60","35":"61","36":"62","37":"63","38":"64","39":"65","40":"66","41":"67","42":"68","43":"69","44":"70","45":"71","46":"72","47":"73","48":"74","49":"75","50":"76","51":"77","52":"78","53":"79","54":"81","55":"82","56":"83","57":"84","58":"85","59":"86","60":"87","61":"88","62":"89","63":"90","64":"91","65":"92","66":"93","67":"94","68":"95","69":"96","70":"97","71":"98","72":"99","73":"100"},
"39":{"1":"26","2":"27","3":"28","4":"29","5":"30","6":"31","7":"32","8":"33","9":"34","10":"35","11":"36","12":"37","13":"38","14":"39","15":"41","16":"42","17":"43","18":"44","19":"45","20":"46","21":"47","22":"48","23":"49","24":"50","25":"51","26":"52","27":"53","28":"54","29":"55","30":"56","31":"57","32":"58","33":"59","34":"60","35":"61","36":"62","37":"63","38":"64","39":"65","40":"66","41":"67","42":"68","43":"69","44":"70","45":"71","46":"72","47":"73","48":"74","49":"75","50":"76","51":"77","52":"78","53":"79","54":"81","55":"82","56":"83","57":"84","58":"85","59":"86","60":"87","61":"88","62":"89","63":"90","64":"91","65":"92","66":"93","67":"94","68":"95","69":"96","70":"97","71":"98","72":"99","73":"100"},
"40":{"1":"26","2":"27","3":"28","4":"29","5":"30","6":"31","7":"32","8":"33","9":"34","10":"35","11":"36","12":"37","13":"38","14":"39","15":"41","16":"42","17":"43","18":"44","19":"45","20":"46","21":"47","22":"48","23":"49","24":"50","25":"51","26":"52","27":"53","28":"54","29":"55","30":"56","31":"57","32":"58","33":"59","34":"60","35":"61","36":"62","37":"63","38":"64","39":"65","40":"66","41":"67","42":"68","43":"69","44":"70","45":"71","46":"72","47":"73","48":"74","49":"75","50":"76","51":"77","52":"78","53":"79","54":"81","55":"82","56":"83","57":"84","58":"85","59":"86","60":"87","61":"88","62":"89","63":"90","64":"91","65":"92","66":"93","67":"94","68":"95","69":"96","70":"97","71":"98","72":"99","73":"100"},
"41":{"1":"26","2":"27","3":"28","4":"29","5":"30","6":"31","7":"32","8":"33","9":"34","10":"35","11":"36","12":"37","13":"38","14":"39","15":"41","16":"42","17":"43","18":"44","19":"45","20":"46","21":"47","22":"48","23":"49","24":"50","25":"51","26":"52","27":"53","28":"54","29":"55","30":"56","31":"57","32":"58","33":"59","34":"60","35":"61","36":"62","37":"63","38":"64","39":"65","40":"66","41":"67","42":"68","43":"69","44":"70","45":"71","46":"72","47":"73","48":"74","49":"75","50":"76","51":"77","52":"78","53":"79","54":"81","55":"82","56":"83","57":"84","58":"85","59":"86","60":"87","61":"88","62":"89","63":"90","64":"91","65":"92","66":"93","67":"94","68":"95","69":"96","70":"97","71":"98","72":"99","73":"100"}},
"Female":{"17":{"1":"29","2":"30","3":"32","4":"34","5":"36","6":"37","7":"39","8":"41","9":"43","10":"44","11":"46","12":"48","13":"50","14":"51","15":"53","16":"55","17":"57","18":"58","19":"60","20":"62","21":"63","22":"65","23":"67","24":"69","25":"70","26":"72","27":"74","28":"76","29":"77","30":"79","31":"81","32":"83","33":"84","34":"86","35":"88","36":"90","37":"91","38":"93","39":"95","40":"97","41":"98","42":"100"},
"18":{"1":"29","2":"30","3":"32","4":"34","5":"36","6":"37","7":"39","8":"41","9":"43","10":"44","11":"46","12":"48","13":"50","14":"51","15":"53","16":"55","17":"57","18":"58","19":"60","20":"62","21":"63","22":"65","23":"67","24":"69","25":"70","26":"72","27":"74","28":"76","29":"77","30":"79","31":"81","32":"83","33":"84","34":"86","35":"88","36":"90","37":"91","38":"93","39":"95","40":"97","41":"98","42":"100"},
"19":{"1":"29","2":"30","3":"32","4":"34","5":"36","6":"37","7":"39","8":"41","9":"43","10":"44","11":"46","12":"48","13":"50","14":"51","15":"53","16":"55","17":"57","18":"58","19":"60","20":"62","21":"63","22":"65","23":"67","24":"69","25":"70","26":"72","27":"74","28":"76","29":"77","30":"79","31":"81","32":"83","33":"84","34":"86","35":"88","36":"90","37":"91","38":"93","39":"95","40":"97","41":"98","42":"100"},
"20":{"1":"29","2":"30","3":"32","4":"34","5":"36","6":"37","7":"39","8":"41","9":"43","10":"44","11":"46","12":"48","13":"50","14":"51","15":"53","16":"55","17":"57","18":"58","19":"60","20":"62","21":"63","22":"65","23":"67","24":"69","25":"70","26":"72","27":"74","28":"76","29":"77","30":"79","31":"81","32":"83","33":"84","34":"86","35":"88","36":"90","37":"91","38":"93","39":"95","40":"97","41":"98","42":"100"},
"21":{"1":"29","2":"30","3":"32","4":"34","5":"36","6":"37","7":"39","8":"41","9":"43","10":"44","11":"46","12":"48","13":"50","14":"51","15":"53","16":"55","17":"57","18":"58","19":"60","20":"62","21":"63","22":"65","23":"67","24":"69","25":"70","26":"72","27":"74","28":"76","29":"77","30":"79","31":"81","32":"83","33":"84","34":"86","35":"88","36":"90","37":"91","38":"93","39":"95","40":"97","41":"98","42":"100"},
"22":{"1":"38","2":"39","3":"41","4":"42","5":"43","6":"45","7":"46","8":"48","9":"49","10":"49","11":"50","12":"52","13":"54","14":"56","15":"57","16":"59","17":"60","18":"61","19":"63","20":"64","21":"66","22":"67","23":"68","24":"70","25":"71","26":"72","27":"74","28":"75","29":"77","30":"78","31":"79","32":"81","33":"82","34":"83","35":"85","36":"86","37":"88","38":"89","39":"90","40":"92","41":"93","42":"94","43":"96","44":"97","45":"99","46":"100"},
"23":{"1":"38","2":"39","3":"41","4":"42","5":"43","6":"45","7":"46","8":"48","9":"49","10":"49","11":"50","12":"52","13":"54","14":"56","15":"57","16":"59","17":"60","18":"61","19":"63","20":"64","21":"66","22":"67","23":"68","24":"70","25":"71","26":"72","27":"74","28":"75","29":"77","30":"78","31":"79","32":"81","33":"82","34":"83","35":"85","36":"86","37":"88","38":"89","39":"90","40":"92","41":"93","42":"94","43":"96","44":"97","45":"99","46":"100"},
"24":{"1":"38","2":"39","3":"41","4":"42","5":"43","6":"45","7":"46","8":"48","9":"49","10":"49","11":"50","12":"52","13":"54","14":"56","15":"57","16":"59","17":"60","18":"61","19":"63","20":"64","21":"66","22":"67","23":"68","24":"70","25":"71","26":"72","27":"74","28":"75","29":"77","30":"78","31":"79","32":"81","33":"82","34":"83","35":"85","36":"86","37":"88","38":"89","39":"90","40":"92","41":"93","42":"94","43":"96","44":"97","45":"99","46":"100"},
"25":{"1":"38","2":"39","3":"41","4":"42","5":"43","6":"45","7":"46","8":"48","9":"49","10":"49","11":"50","12":"52","13":"54","14":"56","15":"57","16":"59","17":"60","18":"61","19":"63","20":"64","21":"66","22":"67","23":"68","24":"70","25":"71","26":"72","27":"74","28":"75","29":"77","30":"78","31":"79","32":"81","33":"82","34":"83","35":"85","36":"86","37":"88","38":"89","39":"90","40":"92","41":"93","42":"94","43":"96","44":"97","45":"99","46":"100"},
"26":{"1":"38","2":"39","3":"41","4":"42","5":"43","6":"45","7":"46","8":"48","9":"49","10":"49","11":"50","12":"52","13":"54","14":"56","15":"57","16":"59","17":"60","18":"61","19":"63","20":"64","21":"66","22":"67","23":"68","24":"70","25":"71","26":"72","27":"74","28":"75","29":"77","30":"78","31":"79","32":"81","33":"82","34":"83","35":"85","36":"86","37":"88","38":"89","39":"90","40":"92","41":"93","42":"94","43":"96","44":"97","45":"99","46":"100"},
"27":{"1":"41","2":"42","3":"43","4":"44","5":"45","6":"47","7":"48","8":"49","9":"49","10":"50","11":"52","12":"54","13":"55","14":"56","15":"58","16":"59","17":"60","18":"61","19":"62","20":"64","21":"65","22":"66","23":"67","24":"68","25":"70","26":"71","27":"72","28":"73","29":"75","30":"76","31":"77","32":"88","33":"79","34":"81","35":"82","36":"83","37":"84","38":"85","39":"87","40":"88","41":"89","42":"90","43":"92","44":"93","45":"94","46":"95","47":"96","48":"98","49":"99","50":"100"},
"28":{"1":"41","2":"42","3":"43","4":"44","5":"45","6":"47","7":"48","8":"49","9":"49","10":"50","11":"52","12":"54","13":"55","14":"56","15":"58","16":"59","17":"60","18":"61","19":"62","20":"64","21":"65","22":"66","23":"67","24":"68","25":"70","26":"71","27":"72","28":"73","29":"75","30":"76","31":"77","32":"88","33":"79","34":"81","35":"82","36":"83","37":"84","38":"85","39":"87","40":"88","41":"89","42":"90","43":"92","44":"93","45":"94","46":"95","47":"96","48":"98","49":"99","50":"100"},
"29":{"1":"41","2":"42","3":"43","4":"44","5":"45","6":"47","7":"48","8":"49","9":"49","10":"50","11":"52","12":"54","13":"55","14":"56","15":"58","16":"59","17":"60","18":"61","19":"62","20":"64","21":"65","22":"66","23":"67","24":"68","25":"70","26":"71","27":"72","28":"73","29":"75","30":"76","31":"77","32":"88","33":"79","34":"81","35":"82","36":"83","37":"84","38":"85","39":"87","40":"88","41":"89","42":"90","43":"92","44":"93","45":"94","46":"95","47":"96","48":"98","49":"99","50":"100"},
"30":{"1":"41","2":"42","3":"43","4":"44","5":"45","6":"47","7":"48","8":"49","9":"49","10":"50","11":"52","12":"54","13":"55","14":"56","15":"58","16":"59","17":"60","18":"61","19":"62","20":"64","21":"65","22":"66","23":"67","24":"68","25":"70","26":"71","27":"72","28":"73","29":"75","30":"76","31":"77","32":"88","33":"79","34":"81","35":"82","36":"83","37":"84","38":"85","39":"87","40":"88","41":"89","42":"90","43":"92","44":"93","45":"94","46":"95","47":"96","48":"98","49":"99","50":"100"},
"31":{"1":"41","2":"42","3":"43","4":"44","5":"45","6":"47","7":"48","8":"49","9":"49","10":"50","11":"52","12":"54","13":"55","14":"56","15":"58","16":"59","17":"60","18":"61","19":"62","20":"64","21":"65","22":"66","23":"67","24":"68","25":"70","26":"71","27":"72","28":"73","29":"75","30":"76","31":"77","32":"88","33":"79","34":"81","35":"82","36":"83","37":"84","38":"85","39":"87","40":"88","41":"89","42":"90","43":"92","44":"93","45":"94","46":"95","47":"96","48":"98","49":"99","50":"100"}}};
var Score1 = valueList[this.getField("Gender").valueAsString][this.getField("Age1").valueAsString][this.getField("PuRaw1").valueAsString];
event.value=Score1;
}
I don't know why, but the syntax error is gone. Now the console when running the script provides the following error for each selection of either Gender, Age1, and PuRaw1.
"
1:Field:Calculate
ReferenceError: string is not defined"
I'm not quite sure how to define either of the three variables other than defining that they are a string. Since I'm pulling their value from a list that is created later on, is there a different way I would define them?
Copy link to clipboard
Copied
the word "string" at the top of you code is not defined. That's a very descriptive error message. Just get rid of the "=string" altogether.
I noticed there seems to be a lot redundancy in your data. If this is true, cause I didn't actually check it all, I would strongly suggest you place the redundant lists of numbers into a separate object that is then referenced in the big list. For example:
var maleNums1 = {"1":"3","2":"5","3":"6","4":"8","5":"9","6":"10","7":"12","8":"13","9":"14 ","10":"16","11":"17","12":"19","13":"20","14":"21","15":"23","16":"24","17":"26","18":"27 ","19":"28","20":"30","21":"31","22":"32","23":"34","24":"35","25":"37","26":"38","27":"39 ","28":"41","29":"42","30":"43","31":"45","32":"46","33":"48","34":"49","35":"50","36":"52 ","37":"53","38":"54","39":"56","40":"57","41":"59","42":"60","43":"61","44":"63","45":"64 ","46":"66","47":"67","48":"68","49":"70","50":"71","51":"72","52":"74","53":"75","54":"77 ","55":"78","56":"79","57":"81","58":"82","59":"83","60":"85","61":"88","62":"88","63":"89 ","64":"90","65":"92","66":"93","67":"94","68":"96","69":"97","70":"99","71":"100"};
var valueList = {"Male":{"17":maleNums,"18":maleNums,"19":maleNums,"20":maleNums,"21":maleNums,
This not only shortens the code and makes it easier to look at, but it also reduces the possibility of an entry error.
Copy link to clipboard
Copied
The first lines should be something like:
var Gender=this.getField("Gender").valueAsString;
var Age1=this.getField("Age1").valueAsString;
var PuRaw1=this.getField("PuRaw1").valueAsString;
var Score1="";
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more