How to create a simple calculation field |
Video DemoSee an online demo of creating a calculation field here: Creating an order form with calculations using Simfatic Forms
Imagine you want to create a simple order form with item quantity and price. Here is how to make one quickly.
We have a pizza order form. A dropdown with pizza type and a "quantity" box to enter the quantity
Here are the items in the 'pizza_type' drop down list:
The pizza price varies with the pizza type . Garlic Prawn Pizza is $10 whereas Funky Chicken Pizza is $12
First, we add a calculation field
Notice the formula: pizza_type * pizza_quantity
Now we need to map from the 'pizza_type' dropdown list items to its price. We can do the mapping in the 'Value maps' tab:
Now we have the calculation ready. Press the Preview button to see it working The formula: pizza_type * pizza_quantity works this way:
Suppose the user selected "Fully Veg Pizza" the corresponding numeric value is taken from the value map ( it is 9) and then multiplied with the value in the pizza_quantity :
Value MapsWhen you are using a selection (radio group, drop down list) in a formula, you have to map the selected value to a numeric value. Simfatic Forms' value map makes this easy. First enter the formula . If your formula contains a selection, the "value maps" tab will have mapping for such selection fields. Just provide the numeric value to be used in the calculation.
Now that the basic step is done, we can add a submit button and proceed to build a full fledged order form
Download the form template here:
More info:
Calculation field : function reference
|