Variable Parameters

◷ Reading Time: 7 minutes

Variable parameters define parameters that deal with values, either simple or complex. They can be defined in different ways for different purposes:

  1. Input
  2. Output
  3. InOut
  4. Local

Let’s see the following example and learn more about each variable parameter.

In this example, the user inputs Income and Employee ID to the application, then the flow calculates the tax using the Tax Rate and shows Tax Amount as the output.

Variable Parameter display

Variable Parameter Types

Input Variables

Input parameters allow your application to send input data and let the logic process it.

In the given example, Income is an input variable.

Variable Definition

So when you debug or run the flow, you are asked to enter the input variable.

When you deploy the project, you need to enter the input variables.

Output Variables

After the execution is finished, your application collects the results from output parameters.

In the given example, TaxAmount is an output variable.

Output variables

To save the final results of the project, we use output variables.

This is the result of the FlexRule Server deployment which contains the output variable.

InOut Variables

Sometimes one parameter must act as both the Input and Output, in which case this direction type can be used. That means when you want to return the inputs as the output, we use this variable type.

In the given example, EmployeeId is an InOut variable. We don’t use it for any calculation. But for identification purposes, we want to know the Employee. So we want it in the output too.

Inout variable

EmployeeId as the input in the request of the deployed package.

EmployeeId as the output in the response of the deployed package.

Local Variables

In some scenarios, processing requires private, local parameters to store the results temporarily. These parameters cannot be accessed once you deployed and they are only available during the design phase.

In the given example, TaxRate is defined as a Local variable.

Local Variable

Local variables are private. You can see that, once you deploy the project, TaxRate is not presented in the request or response.

How to Define a Variable Parameter

There are multiple ways to define a variable parameter in your document.

Using the Parameter Declaration

If you click on the Properties icon, you can select the Variable Definitions under Parameters Declaration.

In the following FlexRule Designer document types you can find a Declaration section.

Using the Variable Parameters Icon

You can click on the Variable Parameters icon on the top menu to define variables.

Right-click on the Document Area

You can right-click and select Variable Parameters.

Define Parameters Using Toolbox

In some other forms of logic (e.g., Tree) for example Procedural trees toolbox should be used to construct the declaration section:

This image has an empty alt attribute; its file name is image-535.png

Procedure tree that constructed the declaration section

This image has an empty alt attribute; its file name is image-536.png

Direct Definition

In Natural Language, in addition to the other approach, you can define Variable Parameters by using the following keywords inside your rule definition:

  1. given, input: to define Input parameters
  2. output: to define Output parameters
  3. local: to define Local parameters

Variable List

When variable parameters are defined, expand the “Variable Definition” node in the properties window to view the list of parameters.

Download the Project

Use the attachment at the end of this page to download the sample.

Updated on December 7, 2023

Article Attachments

Was this article helpful?

Related Articles