Background:  Wholesale lumber yard.  They purchase large “Units” of lumber (you have seen them on trucks).  Their customers order smaller quantities of wood for projects, perhaps different lengths.  Since wood does not have a long shelf life, there is some complex logic regarding which large units should be used for each customer’s order.  However, the operator is allowed to override the system selected units for designing the customers target order.  The business rules are encapsulated into an Aware IM process.  This process has 4 lines of business rules that handle the logic.

As I explain what these lines do, I am going to stress the fact that they can be written in easy to understand English-like business rules.  I will also stress the advantage of placing data in context.   Context is simply defined as once data is read or created, it can be addressed and manipulated without any need to access the backend database.  The Aware IM engine handles all of the heavy lifting.

These 2 features offer unprecedented speed in both development and perhaps more important, maintaining and modifying existing applications as the business requirements change.

The process deconstruction follows:

Line 1:  This will read the Order Line record into context.  You will see how this record is being used in subsequent lines.  This can be written in SQL if so desired, however written in an easy to read, database agnostic, language has advantages:.

FIND OrderLines WHERE OrderLines = LoggedInRegularUser.selectedOrderLine

Line 2:  This rule will open a popup query (or list or grid) of available units, the user can select one and then the selected unit will now be in context. Now there is a record of the selected Order Line and the selected Unit in context

PICK FROM SelectAUnitForCAD

Line 3:  Data validation.  This rule will access the backend database and see if the selected unit has already been assigned to this order line.  The Order Line and the Unit that are in context are understandably used in this logical expression.

IF EXISTS CADSourceUnits WHERE (CADSourceUnits.ps_Unit = Units AND CADSourceUnits.ps_OrderLines = OrderLines) THEN

  DISPLAY MESSAGE ASYNCH DELAY 3 TOP_LEFT ‘This Unit is ALREADY Assigned to this OrderLine!!’

Line 4:  This business rule is the reason why I wrote this article.  Let me explain.  The original requirement was to just create a record in the CADSourceUnits table with the order line and unit that is in context.  It was written as follows:

CREATE CADSourceUnits WITH CADSourceUnits.ps_OrderLines = OrderLines, CADSourceUnits.ps_Units = Units

Six months later the customer’s requirements changed.  The system now had to  check and see if there is a record in this table, entered today for the same unit, and if so, set an appropriate flag to Yes.  All I had to do was surround the existing CREATE statement (similar to a SQL Insert) with an IF statement that queried the database.  Total time to make this change, test it, send it into production was < 15 minutes.  (Did I mention, Aware IM has an integrated test / production database environment with versioning?)

IF COUNT CADSourceUnits WHERE (CADSourceUnits.ps_Unit = Units AND CADSourceUnits.dateDesigned >= CURRENT_DATE) > 0  THEN

  CREATE CADSourceUnits WITH CADSourceUnits.ps_OrderLines = OrderLines, CADSourceUnits.ps_Units = Units,  CADSourceUnits.inPlay = ‘Yes’

ELSE

CREATE CADSourceUnits WITH CADSourceUnits.ps_OrderLines = OrderLines, CADSourceUnits.ps_Units = Units, CADSourceUnits.inPlay = ‘No’

That is it.  4 business rules in 1 process to read data into context, display a list of records for the user to select from, validate the data and conditionally insert data into a table.

If your requirements are for a light-weight application, perhaps a To Do list, or simple inventory lookup, there are many tools that can easily and rapidly build your system.  However, if you need strong, flexible, maintainable, modifiable business rules, then Aware IM should be on your short list.