TDAClientBusinessRuleScript

Overview

The TDAClientBusinessRuleScript provides the Business Rules Scripts class which defines specific rules and actions to validate data input, without having to hard-code this logic into the client and server application.

With business rules scripts, the server can provide the business logic in form of Pascal language scripts as part of the schema; these will then be executed on the client using RemObjects Pascal Script 3.0 (included with Data Abstract).

The TDAClientBusinessRuleScript is used by the TDADataset class. To fill a script text correctly, we recommend to use Schema Modeler: * Open it via the TDASchema component. * Select a data table. * Select the "Businness rules" command on the "Data Tables" pane.

The simple script looks like this:

procedure BeforeDelete;
begin
  if Gain > 50 then
    RaiseError('Cannot delete orders that make us more then 50$');
end;

procedure BeforePost;
begin
  if VarIsNull(ProductID) then
    RaiseError('Please specify a name.');
    
  if Quantity < 1 then
    RaiseError('Quantity can not be less 1 !');

  if UnitPrice < 10 then
    Quantity := 10;
end;

procedure OnCalcFields;
begin
  Gain := UnitPrice*Quantity*(1-Discount);
end;

procedure OnNewRecord;
begin
  Quantity := 1;
end;

Location

 

constructor Create

Creates a new instance.

constructor Create

Assign  override

Copies data from a given source.

procedure Assign(Source: TPersistent)

Parameters:

  • Source: Instance whose properties will be copied

Clear  override

Clears all properties.

procedure Clear

CompileOnServer

Determines whether the script is compiled on the server side.

Note: This property is not used yet.

property CompileOnServer: boolean read write

Description    (declared in TDABusinessRuleScript)

Sets or gets a new description. It can be any user information.

property Description: string read write

RunOnClientAndServer

Determines whether the script is run on the client and server side.

Note: This property is not used yet.

property RunOnClientAndServer: boolean read write

Script    (declared in TDABusinessRuleScript)

Sets or gets a script code.

property Script: CDATAString read write

ScriptLanguage    (declared in TDABusinessRuleScript)

Sets or gets a current script language. For now it only supports one value rslPascalScript. Please refer to the Pascal Script help topic for more details.

property ScriptLanguage: TROSEScriptLanguage read write

ScriptLanguageStr    (declared in TDABusinessRuleScript)

Current script language.

property ScriptLanguageStr: string read write

 

CompileOnServer

Determines whether the script is compiled on the server side.

Note: This property is not used yet.

property CompileOnServer: boolean read write

Description    (declared in TDABusinessRuleScript)

Sets or gets a new description. It can be any user information.

property Description: string read write

RunOnClientAndServer

Determines whether the script is run on the client and server side.

Note: This property is not used yet.

property RunOnClientAndServer: boolean read write

Script    (declared in TDABusinessRuleScript)

Sets or gets a script code.

property Script: CDATAString read write

ScriptLanguage    (declared in TDABusinessRuleScript)

Sets or gets a current script language. For now it only supports one value rslPascalScript. Please refer to the Pascal Script help topic for more details.

property ScriptLanguage: TROSEScriptLanguage read write

ScriptLanguageStr    (declared in TDABusinessRuleScript)

Current script language.

property ScriptLanguageStr: string read write

 

constructor Create

Creates a new instance.

constructor Create

Assign  override

Copies data from a given source.

procedure Assign(Source: TPersistent)

Parameters:

  • Source: Instance whose properties will be copied

Clear  override

Clears all properties.

procedure Clear

See Also