Feature Tour / Business Rules Engine

  SQL Business Rules

Table of Contents
Feature Tour / Business Rules EnginePrint||
SQL Business Rules

A web application data controller can define sophisticated SQL Business Rules that are automatically engaged during the lifecycle of an application. The rules are written in the SQL dialect supported by the database engine (T-SQL, PL-SQL, etc).

SQL Business Rule defined in 'Customers' data controller of the Northwind sample created with Code On Time web application generator for ASP.NET, Windows Azure, DotNetNuke, and SharePoint

SQL Business Rules can interact with the database tier, application server tier, and client web browser tier of a web app.

If you know SQL, then you are already an expert in creating SQL Business Rules.

This is the example of SQL Business Rule performing validation written in T/SQL (Microsoft SQL Server).

-- validate the data field value
if @Country = 'USA'
begin
 -- tell the application server to skip the execution of update, insert, or delete
 set @BusinessRules_PreventDefault = 1
 -- set the focus to the field "Country" and display an error message
 set @Result_Focus = 
    'Country, You are not authorized to ' +  lower(@Arguments_CommandName) + 
    ', if the Country is equal to "USA".'
-- show an additional information in the message bar at the top of the page
 set @Result_ShowMessage = 
    'Error trying to execute ' + @Arguments_CommandName + ' command.'
end

The screenshot demonstrates the business rule in action.

Validation with SQL Business Rules in a web app created with Code On Time web application generator

Take a look at the other example of SQL Business Rules.