TF Pie Quick Guide
This guide will help you create a basic calculator for sum of two numbers. After you have installed the component, navigate to the dashboard. This article will focus on: Operations and Processors.
Basic Concept
Operation: Users enter data in a form through input fields. When the form is submitted, the data is processed based on rules defined for the operation. Finally, the output is displayed to the user.
Processors: These are the rules for the operation. Processors are of different types - Numeric, Math, String, Date, Array.
First Calculator: Sum of Two Numbers
In this calculator, two inputs are required - a and b.
Step 1: Processor
- Create a new processor of type - Numeric.
- Save the processor to edit the options.
- Under the options tab, select type - Addition.
- Enter Field Name 1 as "a" and Field Name 2 as "b". These are the names of input fields we will be adding in the second step.
Step 2: Operation
- Create a new Operation.
- In the fields tab, add two fields of type - text. Enter name and label for each field. The name should match with the names in the processor. In this case, name will be "a" and "b".
- In the Processors tab, select the processor added in step 1. In the step text, Enter "Sum: ".
- Save the operation.
Step 3: Menu Item
To view the form on the frontend, create a menu item for TF Pie -> Operations.
Average of Two Numbers
We can extend this calculator for average of two numbers. Average is calculated by dividing the sum by 2. We have to divide the result of first processor by 2 (which is constant). The result of the first processor is stored in name: r1.
Step 4: Processor
- Create a new processor of type - Numeric. Save the processor to see the options.
- In the options tab, select type - Division by Constant.
- Enter the field name 1 as "r1" and constant as 2. Save the processor.
Step 5: Edit Operation
Input fields are same. In the processors tab, add new processor added in the step 4. In the step text, Enter "Average: ".