How can I multiply the sum of fields with the number of the fields?

  • realtomsamsher
    Asked on December 1, 2016 at 12:52 AM

    how can i do (fieldA+fieldB) times the number of fields added?

    so if there was three A,B,C it would be (fieldA+fieldB+fieldC)3 cause there are three fields?

  • emily
    Replied on December 1, 2016 at 3:06 AM

    Hi,

    Unfortunately, you have to enter the number of fields to the Form Calculation Widget. I created an example demonstration. Please have a look at the screenshots below.

    1. Added three Number fields to the form.

    How can I multiply the sum of fields with the number of the fields? Image 1 Screenshot 60

     

    2. Added Form Calculation widget and clicked on the wizard of the widget.

    How can I multiply the sum of fields with the number of the fields? Image 2 Screenshot 71

     

    How can I multiply the sum of fields with the number of the fields? Image 3 Screenshot 82

    3. Added number fields to the calculation and multiplied the result with 3.

    How can I multiply the sum of fields with the number of the fields? Image 4 Screenshot 93

    4. You can see the resulting form from the screenshot below.

    How can I multiply the sum of fields with the number of the fields? Image 5 Screenshot 104

    If you have further questions, please feel free to ask us.

    Thanks.

  • emily
    Replied on December 2, 2016 at 10:25 AM

    Hi, 

    You can try to solve your problem by using conditions. I made a simple demonstration with two number fields and one Form Calculation field.

     

    How can I multiply the sum of fields with the number of the fields? Image 1 Screenshot 90

    Please check the steps shown in the screenshots below.

    1. Go to Form Calculation widget and click on Conditions button.

     How can I multiply the sum of fields with the number of the fields? Image 2 Screenshot 101

    2. Choose to Update/Calculate Field.

    How can I multiply the sum of fields with the number of the fields? Image 3 Screenshot 112

    3. You need to add the conditions below for two field.

    If only a is filled:

    How can I multiply the sum of fields with the number of the fields? Image 4 Screenshot 123

    If only b is filled:

    How can I multiply the sum of fields with the number of the fields? Image 5 Screenshot 134

    If both are filled:

    How can I multiply the sum of fields with the number of the fields? Image 6 Screenshot 145

    4. You can see the overall conditions below.

    How can I multiply the sum of fields with the number of the fields? Image 7 Screenshot 156

     

    When the fields are filled, the resulting product is 2*(a+b).

    How can I multiply the sum of fields with the number of the fields? Image 8 Screenshot 167

    If you want more fields in your form, you need to have a condition for each possibility. 

    For example if you have 3 field you need to have: a,b,c,2*(a+b),2*(a+c),2*(b+c) and 3*(a+b+c).

    I hope this helps. If you need further guidance, please feel free to ask us.

    Thanks.