◷ 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:
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 Types
Input parameters allow your application to send input data and let the logic process it.
In the given example, Income is an input variable.
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.
After the execution is finished, your application collects the results from output parameters.
In the given example, TaxAmount is an output variable.
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.
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.
EmployeeId as the input in the request of the deployed package.
EmployeeId as the output in the response of the deployed package.
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 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.
- Decision Table
- Generic Flow/ Workflow
- Natural Language
- Business Terms
- Boxed Expressions
- Decision Graph
- Information Requirement Diagram
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:
Procedure tree that constructed the declaration section
In Natural Language, in addition to the other approach, you can define Variable Parameters by using the following keywords inside your rule definition:
- given, input: to define Input parameters
- output: to define Output parameters
- local: to define Local parameters
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.