# Formula Editor

Last updated

Last updated

Just like the Custom JS editor, Nected also has a Formula editor. The purpose of the Formula editor is to provide the user a way to write the same conditions and results with comparatively simpler Excel-like functions, to use inside their rule and in workflow. Where in the Custom JS editor, users can create complex conditions using custom javascript code according to their rule requirement, here they can execute the same complex tasks by simplifying the process with easy Excel-like functions like SORT, FILTER, POW, MIN, MAX beyond the normal addition, subtraction, multiplication, division, and so on.

Access Formula Editor:

Now, using the formula inside a rule and a workflow is pretty simple. The Formula editor is available inside:

Rule:

As Input params

Rule Result

Workflow:

Code Node

In SetVariable node

Response node

Let’s see how you can access the Formula Editor and write your custom code there:

1. Formula in Rule

Inside a rule, the **Formula editor** is available in the rule condition as well as in the rule result.

To use it inside the rule condition, you need to follow these steps:

Open your rule editor

Inside the rule condition section, if you click on the property dropdown, then you can see a section of “

**Custom Functions**” inside that dropdown list.From that dropdown list, select “

**Formula**” to open the formula editor.

To use it inside the rule result, you need to follow these steps:

Open your rule editor

Go to the

**Result**section: After configuring the rule, go to the rule result section, and click the “**+Add Result**” button. From the dropdown options, select “**Formula**”.After selecting Formula, this

**Formula Editor**will appear on the screen.

2. Formula in Workflow

Using Formula editor in workflow is also pretty simple. In the workflow, the Formula editor is available in the Code node, SetVariable, and Response node.

2.1 Code Node

Follow these steps to use the formula editor in the workflow editor:

**Open the Workflow editor**: Open the specific workflow editor where you want to use the Formula editor.**Add Code Node**: Click on + to add the code node.**Open Code Node**: Open the the code node, and from the dropdown at the top of the editor choose Formula.Now you can write the formula that you want to execute inside your workflow.

After clicking the Formula, option from either in rule or workflow, a popup editor will be opened where you can create your formula according to your requirements.

Using Formula Editor

Once the formula editor is opened, you can build your formula using functions like addition, subtraction, multiplication, and so on.

1. Using BODMAS functions for simple calculation

For simpler calculations, you can write simple BODMAS functions i.e. **B – Brackets, O – Order of powers or roots, D – Division, M – Multiplication A – Addition, and S – Subtraction.** You can use static values and custom tokens to dynamically fetch the data from the input parameters and use them inside the formula

**Static Values**: You can use the tokens and can do normal operations using them like this:**Tokens**: You can use the tokens and can do normal operations using them like this:

2. Using Excel-like functions for complex calculations

For more complex calculations, you can use our Excel-like functions to create a custom formula using static parameters or custom tokens to dynamically fetch the data from the input parameters and use them inside the formula. Inside the formula editor, you can use the tokens for:

**Static Values**: You can use the tokens and can do normal operations using them like this:**Using Custom tokens**: You can also call the tokens inside the macro functions. Like this:

Also, we provide a range of **Macro functions**, which they can use to reduce the complexity and improve the execution. Once the user opens the Function editor, they can easily find the macro functions in this **Editor Help** part at the bottom of the Formula editor.

From this All Properties section inside the Editor Help, the user can learn about each macro function as well as they can see examples, take them, and use them to test their first Formula.

To read more about available tokens, refer to the Pre-Configured Tokens.

Test & Publish

After writing the formula, test them using the “Test” button at the top of the editor. Here is how you can test your formula:

After testing the formula, you can simply save it and close it. Also, after the testing, if you get any errors, or you want to add more Excel-like functions in your formula or you need to get more information about the function that you’re using, you just need to click on the “Functions” button just after the “Test” button. This will open the “Nected Formulas” tab again where you can find out the info about all the available formula and their example values.

The Formula Editor in Nected is a versatile solution for executing Excel-like formulas for different business requirements, extending the rule condition capabilities. It helps users to create simple but useful logical conditions, manage detailed outputs, and perform data manipulation and transformation. With its tokenized system, users can easily integrate custom inputs, datasets, and output data for diverse applications. Designed for Nected's varied user base, this tool is accessible to both non-technical users and more experienced developers or data analysts.