Script rule

What it does

Rules based on scripts enable you to create complex custom algorithms for document validation and normalization.

The script rule is configured on the Rules tab of the Document Definition properties.

Parameters

Name Type Access Description
Context IRuleContext According to the rule settings The context of the rule

Procedures that you wish to use in more than one rule should be written to the global rule module, which can be accessed from the script editor. From the drop-down list on the toolbar of the script editor, select Rule Global Script Module. The global rule module can also be accessed from the Document Definition editor (Document Definition → Script Modules → Rule Script...).

Script rules can be used to access records of a cached data set. This can be useful if you need to create validation rules manually. Complete the following steps to access records in a cached data set:

  1. Connect to the data set using the IRuleContext.DataSet method.
  2. Create a query using the IDataSet.CreateQuery method.
  3. Add one or more conditions using the IDataSetQuery.AddValue method.
  4. Use the IDataSet.GetRecords method to get data that satisfies the query. If you need to determine how many records satisfy the query, use the IDataSet.GetRecordsCount method.
  5. You can get records with specific index numbers using the IRecordset.GetRecord method.

If classes and methods of an external assembly are used in the script or global module, the assembly file must be attached on the .Net References tab of the Document Definition properties.

25.09.2020 9:24:45


Please leave your feedback about this article