Advanced Calculated Values

  • 8 December 2015
  • 0 replies
  • 83 views

Userlevel 7
Badge +17

While creating a Nintex Mobile Form, I had a scenario that required I calculate the sums of values. Not very out of the ordinary, but in this scenario each calculation could have differing values. In this form are questions for an inspection form. In general, an office inspection to make user it is safe and secure. If there are issues, then report the point hit. If too many points then different actions will be required. On this form I had several questions asked, if the user checked the question answering Yes, then the related value could be calculated by:

 

  1. Add to the sum a multiple of a value. The multiple must be provided by the user.
  2. Add to the sum a fixed value
  3. Add to the sum a incremental value. If 1, then 25, if 2 then 75, if 3 or more then 300

 

There would be dozens of questions on the form all using one of the three methods above. So I would have to keep track of which question, which value, and what multiple in the calculated field.

 

First here are some screen shots of the form design.

150864_pastedImage_1.png

 

And view in Nintex Mobile from a user

150865_pastedImage_2.png

 

150899_pastedImage_3.png

 

To keep track of the questions and their values I would name the controls like chk1, chk2, chk3 for the check boxes. For the multiplier MV1 for multiply value 1 related to chk1. For the choice of value, chk3a, chk3b, or chk3c.

 

The total violations calculated value was easy, just have it sum the check boxes checked.

150900_pastedImage_5.png

 

I would use the formula If(chk1, 1, 0) +  as to keep the value working in case a question is not checked. For the addition to work I had to add 0, adding nothing would cause no value to appear in the sum.

 

To calculate the sum of the points was the unique part. See the configuration below

150901_pastedImage_6.png

I would use the formula If(chk1, 500*(If(mv1>0, mv1, 1)), 0) + If(chk2, 100, 0) + If(chk3, If(chk3a,25,If(chk3b, 75, If(chk3c, 300, 0))),0)

 

For the first question, if it was checked, then multiply the defined value of 500 by the amount provided by the user. If they provide nothing, then have at least a multiple of 1, otherwise the number they provide. A good tip here is to make sure the value that can be provided in the field is set to Integer only.

 

For the second question, just see if it was checked, then provided the defined value, otherwise 0.

 

For the third question type, if it was checked as yes, then determine the values based on the other checked values. The If formula works as    IF(condition, true value, false value). I required nested if statements to make this work.

 

And that's it, just do this a few dozen times and tada! Cool Mobile form. I can even add attachments of the violations in question.

 

In my following post, I will show how to use validation and formatting rules to make this more user friendly. Take the scenario when the user could check question 3, but then checks both 1st and 2nd violation. How can we prevent that to not make it confusing?


0 replies

Be the first to reply!

Reply