How to add fields and perform calculation?

  • LePeps
    Asked on April 20, 2024 at 2:14 AM

    Hello,

    Inside my 'formulaire', I've a little sheet, because I need toget a total additionning cells data of each columns.

    But, I don't know how to get cells'ref for making the calculation.

    The benefit of this sheet, is that use user can add row by himself.


    At the end, this is what I'm looking for:

    A user may be able to fill

    Qty and Weight inside a sheet.

    but he may have many products, and so he must fill a second row, et so on; and at the end

    he must see total qty and total weight.

    The top of display, is not creating x rows as model ; but rows are creating as necessary by the user.

    Thanks lot for your help.

    e-gor :)

    Jotform Thread 14090041 Screenshot
  • Arghya JotForm Support
    Replied on April 20, 2024 at 5:53 AM

    Hi LePeps,

    Thanks for reaching out to Jotform Support. Unfortunately, it's not possible to add two fields and add more rows at the same time. But, there are two workarounds for that, either you can do it by Input table element or with the Configurable list and Form calculation widget combined. Let me show you how:

    Input Table Element and Form Calculation widget:

    1. In Form Builder, add Input Table Element to your form.
    2. Go to Widgets and add two Form Calculation widgets in your form.

    How to add fields and perform calculation? Image 1 Screenshot 80

    3. Click on Gear icon in Input table element, go to Fields tab, and set Input type as Textbox.

    How to add fields and perform calculation? Image 2 Screenshot 91

    4. Scroll down and customize your Input table's Rows and Column names.

    How to add fields and perform calculation? Image 3 Screenshot 102

    I have added 3 columns and named one column as Product name, so your users can add the product name if they want.

    5. Click on Wand icon in Form Calculation widget.

    6. Click on blue color + Add Field and select all boxes of that column.

    7. Next, to get the total amount you need to add all the fields with +, this will give you the sum of the total value in the Quantity/Weight box. You need to repeat the same process for the Weight field in the other Form Calculation widget.

    How to add fields and perform calculation? Image 4 Screenshot 113

    Configurable list and Form Calculation widget:

    1. In Form Builder, go to Widgets and search Configurable list.
    2. Now, add two Configurable list widgets to your form. Also, add two Form Calculation widgets in your form.

    How to add fields and perform calculation? Image 5 Screenshot 124

    3. Click on Gear icon and go to Advanced tab.

    4. Toggle on Shrink this will shrink the fields and adjust side by side.

    5. Click on Wand icon, and in Field configuration enter your configuration syntax:

    [label]:text
    Example: Quantity : text
    Example: Weight : text

    The portion of the line is [label] this will be used to display the field label. The next syntax for triggering the action. It will add a Short text box that accepts single-line plain texts.​ Repeat the same process for the Weight field.

    How to add fields and perform calculation? Image 6 Screenshot 135

    6. Click on Wand icon in Form Calculation widget.

    7. Click on blue color + Add Field and select all boxes of that column.

    8. After adding the field, enter * 1. Whenever a user adds a field, it will count the number. And if the user deletes the field, then it will automatically remove the value from total.

    How to add fields and perform calculation? Image 7 Screenshot 146

    I have created a Demo form that you can check out. You can also Clone the form. If that’s not exactly what you’re looking for, can you explain a bit more, so I can help you better?

    Give it a try and let us know if you have any other questions.

 
Your Answer