Working with Variables | Automation 101

Опубликовано: 08 Октябрь 2024
на канале: Easyflow
139
3

Hi there! In this tutorial we are going to talk about the different kinds of variables available to you in Easyflow.

Easyflow provides two types of variables:

“Start Event” variables where you can use them to send information to the workflow as input parameters. They are immutable.

“Workflow” variables are used to store and manipulate information inside your workflow logic. They are mutable and can persist information between workflow runs.

In this example we are going to create:

Two “Start Event” variables, “full Name” and “Work Hours”

One Workflow variable called “Total Hours”

Let’s use the mapper connector to build a JSON response mapped with all these 3 variables.

Also, as a first step, let’s use the Variable Setter connector to keep adding the received “Work Hours” to the “Total Hours” variables every time we call the workflow.

Let’s call the workflow and pass 40 to the work hours input parameter. As you can see, the response returns 40 for “Total Hours”.

Let’s call the workflow again and this time by passing 35 to the work hours input parameters. As you can see, the response returns 75 for “Total Hours” which is a summation of the previous stored value 40 and the new input value 35.

Let’s make the case more complex by setting the “Total Hours” variable to 0 after its value bypasses 200 hours. For this we are going to add an additional “Value Setter” step with IF function expression as shown.

Let’s run the workflow again and pass 40 hours to the “Work Hours” input parameter. The sum became 115 now.

Let’s pass an additional 100 “Work Hours”, and run again. The sum became zero because the number bypassed 200 as per our implemented logic.

Thank you for watching this tutorial.
Please feel free to contact us if you have any questions.

Website: https://www.easyflow.com
Contact us: https://www.easyflow.io/contact-us