Cloud Software Group, Inc. EBX®
Documentation > Developer Guide > EBX® Script > API
Navigation modeDocumentation > Developer Guide > EBX® Script > API

Unit core.validation

Script unit that provides methods for setting dependencies in the context of a validation constraint.

Methods

procedure addDependencyToInsertAndDelete(path: string)

Adds a dependency path to specify that the validation result of the current constraint depends on insertions and deletions of the specified table path.

procedure addDependencyToInsertAndDeleteAndModifyInOtherDataset(path: string, dataset: string, dataspace: string)

Adds a dependency path to specify that the validation result of the current constraint depends on insertions, modifications and deletions of the table or the table field specified by its path in another dataset.

procedure addDependencyToInsertAndDeleteInOtherDataset(path: string, dataset: string, dataspace: string)

Adds a dependency path to specify that the validation result of the current constraint depends on insertions and deletions of the specified table of a given dataset in a specific dataspace.

procedure addDependencyToInsertDeleteAndModify(path: string)

Adds a dependency path to explicitly declare that the validation result of the current constraint depends on insertions, modifications and deletions of the table or the table field specified by its path.

procedure addDependencyToModify(path: string)

Adds a dependency path to explicitly declare that the validation result of the current constraint depends on modifications of the field specified by its path.

procedure disableAjaxPrevalidation()

Prevents, in the user interface, the constraint from being pre-validated dynamically when the related field is updated at user inputs.

procedure setBlocksCommitToNever()

Specifies that the current constraint must never block an operation, even if it adds validation errors.

procedure setDependencyToLocalNode()

Specifies that the validation result of the current constraint depends only on the local value of the node.

addDependencyToInsertAndDelete

procedure addDependencyToInsertAndDelete(path: string)

Adds a dependency path to specify that the validation result of the current constraint depends on insertions and deletions of the specified table path. Raises an error if the table path is not found at the specified path when publishing the script.

Node that this method must be called from the procedure setup of the constraint otherwise it is ignored.

Example:

uses core.validation as v;
uses core.message as msg;
export procedure checkTable()
begin
end

export procedure checkRecord(record : .Product)
begin
  if (record.Price < record.Threshold) then
  begin
    var message:='The price of the product '|_ebx.record.Price |' is under the threshold '|record.PriceThreshold;
    msg.addWarning(message);
  end

  export procedure setup()
  begin
    v.addDependencyToInsertDelete('/root/ProductCatalog');
  end

Parameters:

path: the table path.

Can be used in:

addDependencyToInsertAndDeleteAndModifyInOthe…

procedure addDependencyToInsertAndDeleteAndModifyInOtherDataset(path: string, dataset: string, dataspace: string)

Adds a dependency path to specify that the validation result of the current constraint depends on insertions, modifications and deletions of the table or the table field specified by its path in another dataset. Raises an error if the table path or the table field path is not found at the specified dataset when publishing the script.

Node that this method must be called from the procedure setup of the constraint otherwise it is ignored.

Example:

uses core.validation as v;
uses core.data as d;
export procedure check()
begin
  // do some validation checks
end

export procedure setup()
begin
  v.addDependencyToInsertAndDeleteAndModifyInOtherDataset("/root/table/field", 'otherDataset', 'otherDataspace');
end

Parameters:

path: the field path.

dataset: the other dataset.

dataspace: the other dataspace.

Can be used in:

addDependencyToInsertAndDeleteInOtherDataset

procedure addDependencyToInsertAndDeleteInOtherDataset(path: string, dataset: string, dataspace: string)

Adds a dependency path to specify that the validation result of the current constraint depends on insertions and deletions of the specified table of a given dataset in a specific dataspace. Raises an error if the path is not a table path or is not found at the specified dataset and dataspace when publishing the script.

Node that this method must be called from the procedure setup of the constraint otherwise it is ignored.

Example:

uses core.validation as v;
uses core.data as d;
export procedure checkTable()
begin
  // do some validation checks
end

export procedure checkRecord(record : .table)
begin
  // do some validation checks
end
export procedure setup()
begin
  v.addDependencyToInsertAndDeleteInOtherDataset("/root/table",'otherDataset','otherDataspace');
end

Parameters:

path: the table path.

dataset: the other dataset name.

dataspace: the other dataspace name.

Can be used in:

addDependencyToInsertDeleteAndModify

procedure addDependencyToInsertDeleteAndModify(path: string)

Adds a dependency path to explicitly declare that the validation result of the current constraint depends on insertions, modifications and deletions of the table or the table field specified by its path. Raises an error if the table path or the table field path is not found at the specified path when publishing the script.

Node that this method must be called from the procedure setup of the constraint otherwise it is ignored.

Example:

uses core.validation as v;
uses core.message as msg;
export procedure checkTable()
begin
end

export procedure checkRecord(record : .Employee)
begin
  if (record.number < 100) then
  begin
    msg.addError("The number must be at least 100");
  end
end

export procedure setup()
begin
  v.addDependencyToInsertDeleteAndModify('/root/Employee/number');
end

Parameters:

path: the table path or the table field path.

Can be used in:

addDependencyToModify

procedure addDependencyToModify(path: string)

Adds a dependency path to explicitly declare that the validation result of the current constraint depends on modifications of the field specified by its path. Raises an error if the field does not have a local value or is not found at the specified path when publishing the script.

Node that this method must be called from the procedure setup of the constraint otherwise it is ignored.

Example:

uses core.validation as v;
uses core.message as msg;
export procedure checkTable()
begin
end

export procedure checkRecord(record : .ProductCatalog)
begin
  if (not(str.endsWith(_ebx.root.code,'TIBCO_'))) then
  begin
    msg.addWarning("The code must end with 'TIBCO_'");
  end
end

export procedure setup()
begin
  v.addDependencyToModify('/root/code');
end

Parameters:

path: the field path.

Can be used in:

disableAjaxPrevalidation

procedure disableAjaxPrevalidation()

Prevents, in the user interface, the constraint from being pre-validated dynamically when the related field is updated at user inputs. This can be useful to improve performance or to avoid unnecessary validation errors during form updates. However, the constraint will still be validated when the form is submitted or when loading the record in the view.

Example:

uses core.validation as v;
uses core.message as msg;
export procedure checkTable()
begin
  // do some validation checks
end
export procedure checkRecord(record : .table)
begin
  // do some validation checks
end

export procedure setup()
begin
  v.disableAjaxPrevalidation();
end

Can be used in:

setBlocksCommitToNever

procedure setBlocksCommitToNever()

Specifies that the current constraint must never block an operation, even if it adds validation errors.

Example:

uses core.validation as v;
uses core.message as msg;
export procedure checkTable()
begin
  // do some validation checks
end
export procedure checkRecord(record : .table)
begin
  // do some validation checks
end

export procedure setup()
begin
  v.setBlocksCommitToNever();
end

Can be used in:

setDependencyToLocalNode

procedure setDependencyToLocalNode()

Specifies that the validation result of the current constraint depends only on the local value of the node.

Example:

uses core.validation as v;
uses core.message as msg;
export procedure check()
begin
  // do some validation checks
end

export procedure setup()
begin
  v.setDependencyToLocalNode();
end

Can be used in:

Documentation > Developer Guide > EBX® Script > API