Sum of values

1
0
-1

Hi everyone,

I am trying to make simple test app. I have questions, lets say 5, and all answers should be Text. After I answer all questions it should automatically give points for every question. I set up this as (for answer 1 - a_1):

if (q_1=="Moon") return 1 else 0

Etc for other 4 questions.

And it seems it is working. But, in next step which should be sum of all points, my answers are all calculated as 0 again (which is their default values) so the sum (defined as script: a_1+a_2+a_3+a_4+a_5) is always 0 . How to solve this to get real sum of correct answers? Or, better say, how to save values of answers (a_1, a_2, a_3, a_4, a_5) to not return to their default values?

P.S. I tried to remove default values, but then last step brings error.

Thank you all in advance.

Comments

Submitted by jeremykent2726_1 on Mon, 06/15/2015 - 16:07

If you use process variables (instead of transient variables) as bindings to your fields, then you can use a groovy script to do your calculations using the variables' content

Submitted by marcy.ira on Tue, 06/16/2015 - 14:15

I am using process variables and I defined them in groovy script, but still when I want to make some dependencies on calculated variable, in next task value of that variable is again 0

No answers yet.
Notifications