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

  • Profile Image
    realtomsamsher
    Asked on December 01, 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?



    This is a re-post of a comment on Form Calculation - Math Function Reference

  • Profile Image
    emily
    Answered on December 01, 2016 at 03: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.

     

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

     

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

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

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

    Thanks.

  • Profile Image
    emily
    Answered on December 02, 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.

     

    Please check the steps shown in the screenshots below.

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

     

    2. Choose to Update/Calculate Field.

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

    If only a is filled:

    If only b is filled:

    If both are filled:

    4. You can see the overall conditions below.

     

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

    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.