Copy link to clipboard
Copied
I would like to calculated the amount based on the choice selected. Is this possible?
Start amount 1
Start amount 2
4 questions with 2 answers each
Q1 = random amount; choice 1 or 2
Q2 = random amount; choice 1 or 2
Q3 = random amount; choice 1 or 2
Q4 = random amount; choice 1 or 2
Q5 = random amount; choice 1 or 2
Q6 = random amount; choice 1 or 2
Q7 = random amount; choice 1 or 2
Q8 = random amount; choice 1 or 2
Q9 = random amount; choice 1 or 2
Q10 = random amount; choice 1 or 2
Q11 = random amount; choice 1 or 2
Q12 = random amount; choice 1 or 2
Q13 = random amount; choice 1 or 2
Q14 = random amount; choice 1 or 2
Q15 = random amount; choice 1 or 2
End amount 1 = start amount 1 - sum amount for all questions with choice 1
End amount 2 = start amount 2 - sum amount for all questions with choice 2
Copy link to clipboard
Copied
I'm not sure what are start and end amounts, but to calculate total choices you can do it like this:
var c1 = 0;
var c2 = 0;
for( var i=1; i<=15; i++){
var RB = this.getField("Q"+i).valueAsString;
if(RB === "Choice1")c1++;
if(RB === "Choice2")c2++;}
Variable c1 contains total for 'Choice1" and c2 contains total for "Choice2" use them in further calculations that you want.
Copy link to clipboard
Copied
I didn't quite understand how I could make that work with what I have. This is what I am aiming for. Can you provide a little more detail based on this? Thank you
Copy link to clipboard
Copied
Can you show an image from 'Prepare form' where you can see field names, or even better, share your file?
Copy link to clipboard
Copied
I sent you a link to the document if that is okay. Thanks