en en en en en en en en en en en en en en km ka en pt en en ar en en en en en en es ja ru en en en en en fa de en en en en en pt de en da en en en en en en en en en en kn fa en en my cs en en en en en en en en en en en en en en en en en kn en en en my en en en my en en en en en en en en en en en en en en kn fa en en my en en pl en en en en en pl my en en en en en en en en de en pl en en en en en en fa en km en en en en kn en en en my fa en en my en en pl my az en pl en en en en en en en en en en en en en en ka en en en en kn fa en pl my ru en en my de en en my en en en en en en pl en en en pl en en en en de en en en en en en en en en en en en en en en en en en pt en en en en en en en en en en en en kn en en en en en en en en en en en en en kn en en en en fa en en my en en en en en ar en en en kn en en en en en ar en en en en en en en en en en en en en en en en en en en kn en en en en en en kn hi en pl my ru en pl en en ja en en en en en en kn fa en en my cs en pl en fr en en en en en en en en en en en en en en kn fa en en en en en pl en en en pl en en en pl en en en pl en en es en en en kn en hi en my de en pl en ru en en en en en en en en es en en kn en en ja en en en kn fa en en en en ru en en en en en en en ru en en en kn fa en en th en en en en en kn en en en en en kn en en en en en en kn en en en en en en en kn en en fr en en en en az en pl en en en en en en fa en en kn en en de en en en kn de en en en en en en en en en en en en en az en pl kn en en en hu en en en en en en en en en kn hi en en en en en en en en en kn hbs_lat en en en en en en en my pl en en en pl en pl en en en en en en kn en en en en en en en en en en en en kn fa en en my en en pl my en en pl my en en pl en en en en my en en pl my en en en en en en en en en en en en en en en pt en en en en ja en fr hbs_lat en kn en en en my en en en my en en en en en en en en en en en en de en en en kn en en en my az en en my en en pl en en en pl en pt en pl en en en pl en en en en en en en en en en kn en en en my az en en my en en pl en en en pl en en en en en en en en en da en en en kn en en en my az en en my en en pl en en en en en en en kn en en en my az en en my en en pl en en en en en en en kn en en en my az en en my en en pl en en en en en pt en en en en en en en en sv fr fr en en en en en en en km ka en pt en en ar en en en en en en es ja ru en en en en en fa de en en en en en pt de en da en en en
Commands in procedural rules may fall into different categories. They will be available in Procedural logic that your application can create an instance of and execute the rules. These commands are suitable for implementing low-level functionality, algorithms implementation, complex logic validation, communication to external resources, object creation, and variable value manipulation, object and class level method invocation, accomplishing repetitive tasks, implementing modular rules and logic, database access and so on. Also, it is possible to extend the commands in this Procedural logic and define your required behavior.
This group of commands are responsible for declaring and defining the rule structure and available commands on the rule.
This command defines a procedure that is executable in the procedural logic. The entire rule logic must be placed inside this command. A procedure is a low level of functionality or behaviour that can handle complex rules or logic. It is also a reusable part of flow logic. It may have calculations, conditions, assignments, etc. A procedure is an executable routine of a rule or logic. It may have input, output or local parameters from different CLR types. In order for a procedure to execute different commands, it must include a Handlers command. Handlers define what commands are available inside a procedure. Procedures can be divided into different sections named Scope. Each Scope will also be able to accept some parameters.
DESCRIPTION: defines the name of the procedure.
DESCRIPTION: indicates whether the procedure is enabled or not. If the procedure is not enabled during execution, the engine would throw an exception.
This is the section that contains all of the command handlers. This section of a rule will be loaded automatically and is responsible for registering all of the other handlers of the rule. Each command in the rule must be introduced by a handler.
Each procedure must have a section for handlers in which factories create an ActiveElement from the defined model that will be registered. This section will be a container for all activators.
This command requires more Handlers in its scope.
A handler is a factory that provides all the command execution and definition mechanisms in the rule. This is the command extension points of the procedural logic. If you want to conduct any specific task for which we do not provide a command at the procedural rule level then you need to create a handler and register it using this command. All out-of-the-box commands also follow the same pattern to be registered in the rule logic and allow the rules to behave in a defined way using a particular command (e.g., If, While, Database, etc.).
This command defines the activator using the assembly name and type.
Description: Defines the name of the assembly; must include the file extension
Description: Full name of the type, including the namespace
Each rule has a specific signature that defines all of the rule parameters. These rule parameters can be defined in different modes: Input, Output, and Local. And their parameters can be in any internal or custom CLR types. That allows the calling application to be able to send any type of value to rules for processing and then retrieve any types of result from the engine when the processing is finished or even during the execution. Also, Usings can be defined in this section of a rule.
This section is a container for the referencing types and defining parameters in all logic (e.g., Procedural, Flow, Validation, etc.).
This command requires Define in its scope.
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.
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.
Description: Sets the name of each variable
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)
Description: Defines the assembly name holding the type
Description: Defines how each variable’s direction can be used
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.
Description: Sets the default value for a primitive type of variable
Type: Any (string, Int, double, or Boolean); accepts values of primitive types
Defining parameters, there is no need generally to define the type of any parameters.
Define parameter with default value of an empty array:
If there is a type whose static members are required during the evaluation, it has to be registered by this command
A signature may contain some Type parameters that can be defined by this command.
This command can be used in all logic: Procedural, Decision Table, Flow, Workflow, Natural Language, Validation and Decision.
Description: Full address of a type including namespace and type name. Or a ruleset address to a model.
Description: If not specified, the last part of the path will be used, otherwise this can override the name of the type.
Mandatory: No (it’s better to specify an assembly)
Description: Assembly name (including .dll) that has the type of implementation
Description: Indicates if the path is an address to type holding multiple functions
The following, will register type Entities.Publications.PublicationCollection in an assembly named entities.dll with a new name of List.
The following will import a type MyNamespace.MyType in an assembly named MyAssembly.dll:
Which then allows you to call static members by referring to MyType in your logic.
The following sample registers a procedural logic as a function in some other model.
This registers logic in the model called “DataAccessLogicProcedure” that has an output parameter named “list” as a function. So in the current context, you can use it as shown in the following format:
This command will manage a defined parameter’s value. It can access the value and manipulate it. The value can be in any type and the command is able to read and write the value or properties of a value.
This command can be used to evaluate all expressions (i.e., normal, monadic, functions, etc.). Or, when the name attribute is specified, it updates the parameter. For example, it assigns a value to a variable, which can be a simple primitive value such as an integer or a double type, or a computational formula, and (b) accepts nested addressing as the variable name in order to access other scope variables.
When the name is not defined, it evaluates the entire expression that is defined in the value attribute. In this case, all the variables that are used in the expression must refer to defined parameters in the declaration section.
Description: Name of the target variable affected by the calculation or assignment, or alternatively the nested address. This name must be defined in the declaration section of the model.
Description: Reference to the variable name
Mandatory: Yes (either value of ref is required)
Description: Contains the value or formula
Mandatory: Yes (either value of ref is required)
Description: Defines whether the value is direct or it needs to be computed
Mandatory: No (Default is True)
Description: If an extension exists for this variable assignment, it defines the source of the value on which the computation is based. For example, an XML source would be passed to the extension to calculate an XPath.
Type: String (name of another variable)
Description: Enables a set value, not insider properties, on the target object by referencing the properties using a dot or an element of an array using brackets, such as [3] and [index] (index can be an integer variable defined in running context). When the variable you are referencing in name has got some inner properties and you want to target them to update, you can use this setting.
Type: String (referencing object property of array index)
This command defines an extension point in the variable value assignment/calculation process. It must supply two parameters – assembly and handler – and the extension type must implement an interface named IExecutionExtension.
Sometimes, the value cannot be assigned with a setting attribute of value to the Var command, but it can be assigned with the Value command as an internal element.
Change an variable named ‘age’ value to ’10’
Change a property ‘FirstName’ of variable named ‘person’ value to ‘Joe’
In this case item must be defined in the declaration section of the model.
This group of commands is responsible for managing the execution flow inside the running rule.
This command creates a loop and all the child commands inside it get executed until you ask it to exit the loop by using ExitDo. The ‘do’ statement executes a statement or a block of statements repeatedly.
This command creates a scope of iteration in which the execution flow iterates until it receives an ExitDo command. A more conditional (i.e., controlled) iteration command is made available by the While functionality.
This command sends a break command to the execution flow iterating inside the Do command (i.e., a command to end the iteration).
While this is similar to Do, this involves entering a condition which will be evaluated in every iteration of the loop. The engine will exit the execution of the loop when the condition is evaluated as a false value or it reaches the ExitWhile command.
This acts as the Do command, but the execution flow iterates inside the scope only if the condition parameter equals true.
Description: Name of a Boolean variable that checks the continuation of the iteration condition
Type: String (name of variable)
This command sends a break command to the execution flow iterating inside the While command.
This command can be used when iterating a collection or list. The engine exits the iteration when it reaches the end of the collection or ExitIterate command.
This command allows the iteration of a collection or array of objects. The execution flow iterates until it receives an ExitIterate command. A more conditional (i.e., controlled) iteration command is made available by the While functionality.
Description: Variable name of the collection
Type: String (name of variable)
Description: This defines a variable inside the iterator and then allows the executing rule to access each element of the iterator via this naming.
This command sends a break command to the execution flow iterating inside the Iterate command.
When a direct evaluation of a condition is required inside a rule, this command can be utilized. For more complex logic ElseIf and Else can be used to complete the decision.
This command checks a condition and makes a decision based on it. The command has two internal commands – ElseIf and Else, which are used in an If-ElseIf-Else sequence.
Description: Name of a Boolean variable that checks the continuation of the iteration condition
Type: String (name of the variable)
This command (if used) must follow the If command; it has a parameter like that of If that is mandatory.
This command must be placed at the last part of the If command, and no parameter for it exists. The execution flow would be trapped here if neither of the conditions for If and ElseIf were met.
As a condition, you may use Validation Engine to create a structured condition as well by using “Condition” command. In this case you have to pass a variable reference to the “Condition” command using “ref” parameter.
This command will handle any exception occurring inside its execution block. If any exception occurs during the execution, it will go to its Catch block.
This command controls the exception handling of the execution flow in its own defined scope. If an exception occurred during definition, the execution flow would be diverted to the Catch command.
The exception will be assigned to the command’s ref parameter, which will refer to the local variable defined in the procedure.
When an exception occurs, the execution path will come to this block. Then it is time for processing what has gone wrong.
For any conditions for which you may want to halt the rule execution. In this case, this command can throw an exception and halt the rule execution. Your calling application will then receive a signal because of the thrown exception.
This command throws a necessary exception in the procedure and halts the execution.
Description: Sets a message for the exception
Description: Name of the variable with a type of exception that is initialized before being thrown
Type: String (name of variable)
When you need to group similar logic inside a rule so that you avoid duplicating these all over your code, this command will be useful. The other parts of the rule can then Call to a specifically named scope and pass some input parameters and retrieve some results. Also, the scope can be a reusable module between different procedural rules.
This command is a container in which to group the conditions. When no container command exists in the main body of the procedure, it also plays the role of the initialized container.
Note that the name defined for a level of scope must be unique.
A scope can be defined but not executed until it gets called by a Call command, which means that you are able to create modules and reuse them.
Description: Sets the name for a scope
Mandatory: No, unless the enabled parameter is undefined
Description: Indicates whether the scope will be an active part of the execution process or will be disabled
Type: Boolean (true/false) or string (name of Boolean variable)
Description: Indicates whether scope behavior will be executed during the execution process or by the Call command
Mandatory: No (Default value is Routine.)
The commands Declaration and Define can be used to define scope variables.
When dynamic creation of objects is required, this set of commands can be used.
If instantiation of a type is required in the rule execution, this command can be used. It allows the creation of objects from any type using their constructors.
This command enables you to start instantiating a Common Language Runtime (CLR) type or to initialize an array reference. To create a new instance of a type, the constructor of the type should be called.
When only name parameter with no Constructor is provided, it creates a new dynamic object.
Description: Reference of an object to a defined variable of the type
Type: String (name of variable)
Description: Array size should be initialized.
Description: Type address of the type to be created
Type: Name that is registered by ExecutorSetup.TypeIdRegistry.Register
Description: Assembly name that has the type to be created
Type: Name of assembly including its extension
Description: Full type name that is going to be created
Type: Full type name
This command, which defines the constructor of the type to be used, must be placed inside the New command when a new instance of Type is being created.
This command, which defines parameters passed to the type constructor, must be placed inside the Constructor command.
Description: Defines parameter type
Description: Directly sets the value for the parameter
Description: Sets the value for the parameter by referencing a variable
Mandatory: No (No constructor command is required yet.)
Type: String (variable name)
Creating a new object from a type by providing Constructor and Constructor’s Parameter:
Creating new object and adding properties to it:
This command is a type constructor selector. It selects a suitable constructor of a type to be used to instantiate an object.
Creating an array of objects is possible using New command. However, it might be easier to use this command instead to populate the values of the array directly.
This command initializes an array and enables the assignment of items in an array with other commands.
Description: Reference of an object to a defined variable of an array type (e.g., System Object)
Type: String (name of variable)
Every item is added through this command, inside of which other commands can be placed, such as New, Var, and CallMethod.
Sample 1 – New instance creation
Use New to create a new instance of a type
Sample 2 – Full rule to add objects into a collection
Use Var command and CallMethod command
This command will be used inside the Array command and will add values for each index of the array.
Adds values to a list. Each child node inside Add command will be considered as a result to be added to the list.
Description: Name of the list to be used for appending elements
Type: String (variable parameter name)
This command creates a list that can act as a collection or set.
This command allows the building of a template to generate a table of data based on a set of inputs.
Calls out to any REST API and returns the results.
When there are objects defined inside a rule, this command can make a call to the object methods.
This command enables you to make a method call on a CLR object. You can pass the object reference to the procedure from the application or create the object using object creation commands. Either way, this command enables a method call on the instantiated object.
The method parameter can be passed directly as part of the method signature or in a more controlled form through the Param command.
Description: Name of the method of the object, which also includes the object reference
objectReference.MethodName (In this format, Param commands are mandatory.)
Type: A string in the given format
Description: A variable in which the method result is stored
Type: String (name of the variable)
This command passes a value to the method for referencing.
Calling a function and method by passing input parameters as embedded elements rather than attribute values.
If your application logic is complex and requires multiple Procedural rules, this command can call an externally defined rule and return the result to the running execution context.
In a procedural engine, multiple procedures can be interlinked. This means that a procedural rule can execute another rule; thus, the context of the parent rule can be shared, and the result can be copied back to the root context. Different scenarios can be managed in several ways.
Description: Sets the context for the called procedure
New: Creates a new context and uses such context for execution; in this case, the variable of the new context must be registered by the Param command
Shared: Uses the current context for execution and the new procedure after finishing the procedure execution; the current execution variable context (of only out-variables) is copied to the original one
Description: This attribute is set when the target procedure has variables that need to be accessed via the root executing procedure.
None: Does not copy
AddBoth: Copies both in- and out-variables
Description: Sets a value of a parameter as a return value of the operation/call
Types: String (name of a parameter
This command passes a value to the procedure and registers new variables in a new context if required.
This command provides the rule with a source to be loaded and executed. It can be a relative or absolute file path or a RuleSet address. If it is a relative file path, the location is initiated from your application’s execution folder. If it is a RuleSet address, it should be a valid address, and the engine should be initialized using RuleSet overload.
When your rule has some scopes this command can call to and execute the scope, and then return to its previous execution path.
Once the modules are defined (i.e., checked for Scope), you can execute them using the Call command.
This command needs only the address of the module, either the name of a scope or a nested address. The module must be in the same scope level as the Call command used.
Parameter values can be passed to the calling module using Param commands, and output direction variables can be read from the called module using the Var command.
Description: Address of the called module, either a single scope name or a nested address
Type: String (module name)
Sometimes the calling application requires signals to be received from the executing rules. This command will send an event to the running engine and then your application and handle the event required to respond to the rule signal.
This command sends a callback to the application hosting the engine, which can be an actual running application, Windows service, Windows Communication Foundation, web service, or any engine host (container).
Description: Sends a value to the host
Mandatory: No (Either tagRef or tagValue must be supplied.)
Description: Sends a value reference to the host
Mandatory: No (Either tagRef or tagValue must be supplied.)
Description: Sends a key to the host to make a decision in a specific channel by key value
Description: Receives a response from the host and sets the value on the running context of the rule
Type: String (name of variable)
When scopes are defined on a separate physical layer (different files than the actual rule), this command will load the external scope inside the current loaded rule.
This command enables you to split your procedural rules into more dynamic scopes and to import each scope to the body of the rule during the execution process. By supplying the source to be imported as a string or IElementModel type, the scope will be considered as part of your rule body.
If the imported scope is a string type, it must be encoded as a valid XML or RuleSet address. If it is an XML, its special characters must be respected. Also, the imported string must be encapsulated with a Scope command. If it is a RuleSet address, it should be a valid address, and the engine should be initialized using RuleSet overload.
The behavior included will not be executed. In order to do so, the Call command must be used. The included source parameter can accept a ruleset address as well (e.g., ruleset://flow/main?parameter:name=CreateCaseOfficer)
Description: Assigns a source that is imported by the command, as well as a variable name or ruleset address. If it is variable name, the variable type must be defined as a String or IElementModel.
Type: String (variable name)
For lots of commands, some initialization values are required. This command is responsible for preparing and passing the values to the Rule commands.
This command passes a parameter for different purposes: calling a scope, instantiating an object, or passing values to a constructor.
Description: Name of the target object variable
value (either this or a ref must be supplied):
Description: Contains the value or formula
ref (either this or a value must be supplied):
Description: Contains the reference of the variable name or can be a nested address
Description: Defines whether the value is a direct value or needs to be computed
Type: Boolean (true/false). Default value is true.
Description: Type of value supplied
Description: Name of the assembly if the type is custom-built
This command behaves differently by defining or eliminating different parameters:
1. type: tries to create an object from a provided value without any evaluation of the value
2. eliminating type: tries to evaluate the value provided if the process is set to true, or if no process is found.
The following Param commands demonstrate the sample. They try to evaluate the value which is going to parse a string as a DateTime.
The following sample tries to create value as a double number:
The following sample tries to create the value as a string. Please note the value is not quoted in ” or ‘.
The following sample tries to evaluate the value expression. Because the type is not defined and process is true by default, the value becomes an expression and requires evaluation.
This set of commands enables the rule to communicate with a data source (database) and retrieve a value, single row or multiple rows as part of the rule execution process.
This command defines a connection to a data source: MsAccess, MsSql, Oracle, ODBC.
See this article to read more.
This command defines the database to execute TSQL or a Stored Procedure against a data store. It supports built-in database types as well as custom databases (e.g., PostgreSQL). If your database is not built-in:
then you should provide a type address to IDbconnection and the related assembly.
Description: A connection string to the database
Description: A reference to a connection string variable holding a value
Description: Type of database
Type: MsAccess, MsSql, Oracle, Odbc or alternatively, type can be the CLR Type name including namespace that has the IDbConnection implementation.
assembly: The assembly name that has the custom IDbConnection connection.
SelectRow, SelectValue, SelectList, ExecuteNonQuery, ExecuteScalar
When rows are required to be retrieved from a database table, this command can be used.
This command selects one or more records from a database table. The return value from the database will be one or multiple rows (i.e., an array of rows). Each row will have a GetValue (string name) method that can be accessed to read the value of the columns of the row; otherwise, its indexer can be used.
Description: The Select command
Description: Name of the variable in which the row will be stored
Description: Determines whether the command should execute a stored procedure in the database
Description: Indicates whether the Select command will return multiple rows
Description: Indicates whether the Select result will be returned as a single/list of ExpandoObject
Description: True when the ‘command’ is going to be evaluated against the current execution context, otherwise false.
This command sends a Break command to the execution flow iterating inside a Do command.
When rows are required to be retrieved from a database table this command can be used to create a list of values, either simple primitive values or complex object values.
This command is very similar to SelectRow command the difference is it builds a list for values based on the return result from the query. If one column is selected from SELECT command, then the list contains all the values for that selected column only. If multiple columns are selected, then the list contains a complex object that the values of the column can be accessed by object properties.
Description: The Select command
Description: Name of the variable in which the row will be stored
Description: Determines whether the command should execute a stored procedure in the database
Type: Boolean (true/false). Default is true.
Description: Indicates whether the Select command will return multiple rows
This command sends a Break command to the execution flow iterating inside a Do command.
Return list is a list of string values:
Return list is a list of objects that have tow properties: made and model
When a single value (cell value) is required to be selected from a database table, this command can be used.
This command returns a single value from the database.
Description: The Select command
Description: Name of the variable in which the row will be stored
Description: Determines whether the command should execute a stored procedure in the database
When the Insert, Delete or Update command is required, this command can be used.
Database commands such as Insert, Delete and Update can be performed using this rule command.
Description: The TSQL command
Description: Name of the variable in which the row will be stored
Description: Determines whether the command should execute a stored procedure in the database
If the result of executing a query returns a value, this command should be used.
This command can be used when you wish to run a query command result (or more likely a stored procedure) that returns data.