◷ Reading Time: 1 minute
Define
This command defines the rule parameters. It can be in different directions: Input, Output and local. There is no limitation on the numbers or types of the defining parameters. It can either have none or as many parameters as required. The input parameters must be passed through with the executing applications.
Summary
Every single variable to be used in the rule body must be defined first, from which it can be used as a part of the rule logic.
Parameters
- name
- Description: Sets the name of each variable
- Mandatory: Yes
- Type: String
- type
- Description: Sets the type of each variable
- Mandatory: No
- Type: Type
- friendly name: a string representing default primitive types (e.g., int, double, string, DateTime, etc.)
- full type name: a Namespace and Type name combination (e.g., System.DateTime)
- assembly
- Description: Defines the assembly name holding the type
- Mandatory: No
- Type: String
- direction
- Description: Defines how each variable’s direction can be used
- Mandatory: Yes
- Types
- In: The variables assigned will be given a value before execution.
- Out: The result of the procedure will be accessed by the values.
- Local: Intended for internal calculation and accessible only inside the procedure that defined it
- InOut: Allows input and output for the parameter.
- value
- Description: Sets the default value for a primitive type of variable
- Mandatory: No
- Type: Any (string, Int, double, or Boolean); accepts values of primitive types
Samples
Defining parameters, there is no need generally to define the type of any parameters.
<Declaration>
<Define name="order" direction="in"/>
<Define name="settings" direction="in"/>
</Declaration>
Define with specifying type:
<Declaration>
<!--
Imports the System.Console class to be used
In the procedure as a method call
-->
<Using path="System.Console"/>
<Define name="itemNo" type="System.Int32" direction="local"/>
</Declaration>
Define parameter with default value of an empty array:
<Declaration>
<Define name="orders" type="expression" value="array()" direction="out"/>
</Declaration>