Integrate Calculator

We’ll assume that you already know how to add tasks to a workflow and have added the Calculator task to your workflow.

Setup the 'Evaluate a mathematical expression' Calculator task:

  1. Select the Calculator tab of the ‘Evaluate a mathematical expression’ Calculator task.

  2. Fill in the mathematical expression to be evaluated.

    Examples
    Expression Result
    sqrt(3^2 + 4^2)5
    sqrt(-4)2i
    2 inch to cm5.08 cm
    cos(45 deg)0.70711
    150*1.20180
    log(1000, 3 + 7)4

    Refer to mathjs for all the valid mathematical operators.

    You can also pull-in dynamic information from earlier fields (e.g. values from order forms).

    As example, calculating 20% TAX on the sum of the values of 2 fields: ({field.value:****}+{field.value:****}+{field.value:****})*0.2

  3. Set the result’s precision. It defines the total number of significant digits returned.

  4. To use the result of the calculation in another task later on in the flow, start by typing {response where you want it pulled-in and select the ‘Response Status (…)’ dynamic field tag of your Calculator task. A dynamic field tag similar to {service.response:****:kotive_request_status} will be inserted. Replace kotive_request_status with result so that you end up with {service.response:****:result}.

Tip

You can pull a result from the calculator task into the mathematical expression field of another Calculator task. E.g. Calculate the amount of tax in the first task, then add the result to the total of the purchase in the next calculator task.

Done! You have now fully integrated the Calculator with your Kotive workflow. When a workflow runs, it will automatically do the calculations and return the result.