I have a form that looks for responses to about 30 questions. Each question has a yes/no toggle. When the toggle is 'no' a drop-down appears (and is required) for the user to select 1, 2 or 3. This is controlled by a rule, with one rule for each question.
I am looking to capture the highest score applied as the user proceeds through the form. I have created a form variable (integer) and set '0' as the default value.
What I'd like to do is convert the selected score to a number, then test if it is > the value of the running score. If that test is true, then I set the running score to that value. If it is false, then the running score remains at the highest score previously logged. I can't find a way within the rule to adjust the value of my running score - am I missing something?
Would be grateful for any suggestions, I'd like this cumulative score to be visible to the user before the form is submitted.
Solved! Go to Solution.
Just to clarify if a user inputs 1 on the first choice you want the running score to be 1. Then if the user inputs 2 on the second choice you want the running score to be 2 correct? because 2 >1. And so on and so forth if the user selects 3 for an answer on a subsequent choice control.
Well, you could create a form variable with a formula like this:
max(convertToNumber([Form].[Choice single 1]),convertToNumber([Form].[Choice single 2]),convertToNumber([Form].[Choice single 3]))
Unfortunatly you cannot bind a form-variable to a field in the form, so the computed value will not be visible in the form, but it is available in the workflow.
Thanks for that, eiben - I now realise that I cannot do what I want. I was very much looking to have the result visible as the form is being completed, because it's a form to record observation of a safety procedure, and both the observer and the observed party are expected to sign indicating agreement. The exercise may take place in a location without network connectivity, so a workflow wouldn't execute until the observer returns to a location from where the form will be submitted.
I defined a variable exactly as you suggested but got stuck when I tried to set a rule for each question that would compare the score for that question with the running score variable and update a 'Maximum Score' field with the then-current value of the variable.
I'll have to re-think the approach with the stakeholders.
The response, however is very much appreciated!
Solution identified after some discussion with a Nintex field support rep:
1. Define a field 'RunningScore' or similar and set initial value to 0.
2. For every individual score collected on the form, define a rule that tests the value of the selected score, and set 'RunningScore' to the value being tested. In other words
If [Score] = 1, then [RunningScore] value is 1.
2. Repeat to find scores of '2 - the first one encountered will set the value of RunningScore to 2.
3. Repeat for score values 3 through n.
It's not especially elegant but it works.