Calculator Component

Overview
The Calculator component is a logic tool used with two or more components to carry out a calculation. A simple use of a Calculator is to add numbers from two different fields.
- Concatenating (or joining) two or more values.
- Performing advanced calculations involving several components.
- Calculating duration.
- Pushing data from one component to another.
As you can see, the Calculator component is a versatile tool in your Unqork arsenal. To configure your Calculator component:
1. | Enter your input components, and assign them simple aliases. |
2. | Create a formula using your defined aliases. |
3. | Set an output component to hold the result of your calculation. |
You can find the Calculator component in the Data & Events Processing group to the left of the Module Builder.
What You'll Learn
After completing this article, you’ll know when to use a Calculator component, how to configure its settings, and how to use it in an Unqork application.
About the Configuration Window
To learn more about general component settings and those that display when a component is associated with Data Models, view our General Component Settings article.
Display Panel
Field Text
Setting |
Description |
---|---|
Canvas Label Text |
A component’s Canvas Label Text indicates the purpose of the corresponding field or component. For non-input components, the Canvas Label Text isn't end-user facing, and only appears in the Module Builder. User-friendly labels make your module more accessible. Keep labels short and descriptive (a word or two) using title case. For longer entries, use sentence case. For the Calculator component, it's best practice to use the same value for Canvas Label Text as your Property ID:calcXxx. |
Adding a Calculator Component
For this example, let's look at an inventory count for a high-end outfitter. To create this application, you'll use four Number fields for inventory counts. Then, you'll add a Calculator to calculate the total.
In this configuration, you need the following components:
-
4 Number components
-
1 Calculator component
Configure the Number Components
Think of your Number components as buckets for the number of small, medium, and large clothing items you have in inventory. These components act as inputs for your Calculator component. Then you need a final Number component to hold the calculated total.
1. | In the Module Builder, drag and drop four Number components onto your canvas. |
2. | In the Property ID and Label Text fields, enter the following: |
small |
Small |
medium |
Medium |
large |
Large |
total |
Total |
3. | Click Save Component for each component as you complete it. |
Configure the Calculator Component
Now that you have a spot for each inventory count, use a Calculator component to add them together. Set each Number component as an input, then enter the logic behind your sum calculation.
1. | Drag and drop a ![]() |
2. | In the Property ID field, enter calcTotal. |
3. | In the Canvas Label Text field, enter calcTotal. |
4. | Set the Trigger Type to ![]() |
5. | To the right of Inputs & Outputs, click Edit. |
6. | Complete the Inputs table as follows: |
Source |
Alias |
Required |
---|---|---|
small |
S |
☐ (unchecked) |
medium |
M |
☐ (unchecked) |
large |
L |
☐ (unchecked) |
7. | In the Outputs table, enter the following: |
Source |
Formula |
---|---|
total |
=SUM(S,M,L) |
To discover more formulas, view our Supported Formulas page.
8. | Click Save Component. |
9. | Save your module. |
Preview your module in Express View, and test it out:
Resources