Copy link to clipboard
Copied
Sorry for the complex question...
I'm trying to use conditional logic to total scores for a vulnerability assessment. Based on the answer, a score is assigned to the fields and then totaled by section. I'm struggling with the text box value. For "In what language do you feel best able to express yourself?" the value should be 1 for any answer besides "English". I looked around at a lot of questions regarding this and couldn't come up with an answer. The closest I got was using IF/ELSE to try and get the values correct.
The other fields are all set up as Radio buttons, so the value export is much easier. However some of the scoring section says things like "if question 8 OR 9 is a 'yes' then 2 points". Trying to wrap my head around how that looks in the custom calculation script. Any help is appreciated!
Copy link to clipboard
Copied
It's a lot easier to use numbers as the export values, then you don't need scripts. You can use the "Sum of" calculation. For example, the export values for Gender would be 0, 1, and 0. The Score would be sum of Gender. For the ones that do have conditions you would write a conditional statement like you did for the Age score. The following article should provide you with some tips, although it uses mutually exclusive check boxes instead of radio buttons to every score in the set would need to be different but the principle is the same.
https://pdfautomationstation.substack.com/p/create-a-check-box-scoring-questionnaire
Copy link to clipboard
Copied
1 .In your calculation script use something like this (let's say you have a variable called "score" already defined):
if (this.getField("Language Preference").valueAsString.toLowerCase()!="english") score++;
2. Again, using the same assumption as in #1:
if (this.getField("Visa Assistance").valueAsString=="Yes" || this.getField("DACA").valueAsString=="Yes") score+=2;