where Business Processes, Data and Rules meet.

Procedural

Home / Rules Engine / Procedural

Samples

30 Days Free Licence and Support

FlexRule Runtime 7.0.295 (Download Now)
FlexRule Designer 7.0.259 (Download Now)
FlexRule Server 2.4.2 (Download Now)
Technical Document (Download Now)

Procedural: Calculation and Iterations

P

rocedure rules are suitable for implementing complex rules and logic. Or there might be some part of the application which are unclear yet to be hard-coded. Or some logic look they need a full fledge compiled code to handle all required flow control, conditions, variable and resource access, calculations. The fact is, all can be implemented as a procedural rule. So instead of hard coding them as a compiled, static and executable code you can benefit from having a dynamic and flexible procedural rules and logic, then delegate the execution to our procedural rule to execute your implementation.

 

Complex logic may have one or more of the following behaviour:

  • May have formula or calculation logic
  • May need to implement sequential If-ElseIf-Else conditions
  • May require to do a loop, iteration or implement an algorithm
  • May need to have input parameters of any type be passed from applications/systems/users
  • May require to return some values of any type to applications/systems/users
  • May need to access to external resources (Database, files, xml…)
  • May need to instantiate an object of any type (class) and/or require to access object – properties/attributes values or call object methods

A Picture is Worth a Thousand Words. Are You a Visual Person? Try Rules Visually.

  • Complex Logic

    Like your programming language, implement any complex routine, formula calculation or low level mechanisms out side of your codebase.

  • Reusable

    Divide the procedure logic into different sections and call them whenever required. This can be shared between different procedures or flow.

  • Change or Extend

    Simply change the behaviours by callbacks and events or add your own custom commands

Parameters and Value Assignment

Parameters are values that your application may need to pass to a procedural rule or expect retrieving it from the rule. There is no limitation on defining parameters in procedural rules. A procedural rule may have Input, Output and Local parameters of any CLR or custom type/class as many as it requires.
Once the rule has got any Input parameters, for executing the rule, application has to pass values for input parameters. When the execution has finished or even during execution time, the application may retrieve the values of the Output parameters.
Once a parameter has been defined in a rule it can be access though out the rule definition and your rule can access the parameters in order to read or write value of the parameters.

Objects Manipulation

In procedural logic, rules are dealing with objects and types. Rules may require to create objects from different types. May need to read and write values of an object’s property. Or call a method of an object and decide what needs to be done with the return value.
In procedural rules it is possible to to all those tasks as follow:

  • Instantiation of objects
  • Object’s properties read and write
  • Object’s method call
Communication Mechanisms

Generally application asks for rules execution. This would be a one-way communication model. But it is possible that rules communicate back to application as well. When the application using our framework to execute a procedural rule, there are couple of options that the rule can communicate back to application and does something in application context.
There are two options for these scenarios:

  1. interface base communication:
    In this case application creates an object and pass it to rules as a parameter and holds to the object reference. Then rule can use that parameter to call a method of that reference variable and application can receive the message from rules.
  2. event base communication:
    In this scenario the communication is more low-coupled. the rule can raise events and application would require to handle engine level call back event to receive those messages.

procedural1

In the event arguments, the rule can pass values and a key to the client application. Then the client application would be able to read the values and key and return some results to the executing rule.

 

Flow Control

When a procedural rule is executing, it goes through different execution path and is some cases having control on the execution path is required.

Procedural logic supports the following controllers on the execution path:

  • Condition control: IF-Then-Else
  • Exception control: Throw, Try, Catch
  • Looping control: While, ExitWhile, Do, ExitDo
Calculation, Expressions and Evaluation

A procedural rule is capable of executing any simplex and complex mathematical and non-mathematical calculation. It allows any kinds of operation:

  1. Arithmetic
    1. Simples (+/*-%)
    2. Complex (Round, Abs…)
  2. Boolean (| & !)
  3. Comparing (< > == <= >=)
  4. String (+)
  5. Custom user defined operations

You are not limited to those and you can use your existing application functions or develop custom ones and use them are part of your rules.

Builtin Database Capability

This allows the rules communicate with database and read data from a database. The database can be either of MsSql, Access, Orcle or Odbc. The data can be read as multiple rows or a single value of a column. Then the rule can take decision based on the values read from database.

Don’t Miss Your 30 Days Free Trial Licence With Free Support

Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.