Help > Setting up ReadSoft Capture Framework > Configuring business logic > Business rule templates

Business rule templates

A set of default business rule templates is supplied by the assembly xboundOcfValidationBase.dll, located in the XBOUND program directory. The first time you access business logic, you must add this business rule library.

Then these business rule templates are displayed in the Business rule templates pane:

ClosedBarcodeToField

This business rule transfers one or all barcodes to the field using a separator.

Parameters

Description

pField

Field.

copyFirstBarcodeOnly

  • 0: All barcodes are transferred.

  • 1: Only first barcode is transferred.

separator

Separator.

ClosedCaptureComponents_CheckClassificationConfidence

This business rule checks:

  • Whether the classification confidence reaches a specified threshold. If not, the field is deleted and displayed in Verification.

  • Whether the classification confidence reaches a minimum level. If not, the field is deleted and displayed in Verification.

  • Whether the confidence level of classification and separation was Certain.

Parameters

Description

Context

ValidationContext object (provided by the system; not configured by users).

pField

Field.

pMinConfidence

The minimum confidence that must be reached in order for the document to be set to Valid.

pConfidenceThreshold

The confidence threshold that must be reached; otherwise the recognized value is discarded.

pConfidenceStatus

If 1, the confidence threshold will apply to classification and separation.

pMinConfidenceDistance

The confidence separation (difference) between alternatives, when multiple alternatives are found. Not yet implemented.

ClosedCaptureComponents_CheckExtractionConfidence

This business rule checks:

  • Whether the extraction confidence reaches a specified threshold. If not, the field is deleted and displayed in Verification.

  • Whether the extraction confidence reaches a minimum level. If not, the field is deleted and displayed in Verification.

  • Whether the second extraction alternative has sufficient distance (difference) from the best alternative.

Parameters

Description

Context

ValidationContext object (provided by the system; not configured by users).

pField

Field.

pMinConfidence

The minimum confidence that must be reached in order for the document to be set to Valid.

pConfidenceThreshold

The confidence threshold that must be reached; otherwise the recognized value is discarded.

pMinConfidenceDistance

The confidence separation (difference) between alternatives, when multiple alternatives are found. Not yet implemented.

ClosedChangeParentDocument

This business rule moves the current document to a the last preceding document of specified document type.

Parameters

Description

pContext

ValidationContext object (provided by the system; not configured by users).

pParentDocTypeName

Document type of the target document.

ClosedCheckConfidenceRank

This business rule checks if the read result of field or cell is certain. If not, validation fails.

Parameters

Description

pContext

ValidationContext object (provided by the system; not configured by users).

pField

Field.

ClosedCheckForInvalidCharacters

This business rule checks for invalid characters in the specified value. You can provide the invalid characters without a separator in the pInvalidCharacters parameter.

Parameters

Description

pValue

Value. Map this parameter to a varchar field.

pInvalidCharacters

One or more invalid characters (no separator expected).

ClosedCheckLength

This business rule checks if the length is between the specified minimum and maximum length.

Parameters

Description

pValue

Value. Map this parameter to a varchar field.

pMinLength

Minimum length. If minimum length is set to -1, it is not checked.

pMaxLength

Maximum length. If maximum length is set to -1, it is not checked.

Example:

A CheckLength comparison has three parameters: pValue, pMinLength, and pMaxLength. The pValue parameter is typically set to a field, for example PostCode. This field should be validated, so we select the box in the Validated column. When something changes in the PostCode field, we want to reapply the rule. Therefore, we select Trigger.

The pMinLength parameter is a constant and is set to 3. Triggering and validation are not relevant here.

The pMaxLength parameter is extracted from the PostCode Length field. However, this field is only for dynamic data transmission; the value for pMaxLength is not fixed but comes live from the field. This field is not validated, so Validated is not selected. However, when PostCode Length changes, we want to reapply the rule, so we select Trigger.

ClosedCheckRegEx

This business rule checks if a value matches a specified regular expression.

Parameters

Description

pValue

Value. Map this parameter to a varchar field.

pIgnoreCase

Ignore case. If true, capitalization is not relevant.

pSingleMatchOnly

Value may only fit once to pattern.

pPattern

Regular expression.

ClosedCheckRejects

This business rule checks if the field or cell contains rejects or suggestions. If so, validation fails.

Parameters

Description

pContext

ValidationContext object (provided by the system; not configured by users).

pField

Field.

ClosedCombineFields

This business rule combines fields with another field using the specified separator.

Parameters

Description

pTargetField

Target field.

pSeparator

Separator.

pIgnoreEmpty

Ignore empty fields. 1= true; 0=false.

pField1

Field.

pField2

Field, optional.

pField3

Field, optional.

pField4

Field, optional.

pField5

Field, optional.

ClosedCompareFields

This business rule compares the current field with a specified comparison field on the parent document (not case-sensitive).

Parameters

Description

pContext

ValidationContext object (provided by the system; not configured by users).

pField

Field.

pCompareFieldName

Name of the comparison field.

ClosedCountMedia

This business rule counts the media that match the specified criteria (searchTerm) in the current document and reports that number to the specified field (targetField).

Parameters

Description

context

ValidationContext object (provided by the system; not configured by users).

targetField

The field to report the number of matching media to. The number is saved as a string (0, 1, 2, etc.). If there is an error, the target field remains unchanged.

searchTerm

A comma-separated list of criteria that the media must meet in order to be counted. Each criterion consists of three parts:

  • A property name – one or more of these:

    • Format: The format of the medium (for example TIFF), or an empty string for media with no format specified.

    • Name: The name of the medium, or an empty string for media with no name specified.

    • Type: The XBOUND document type of the medium, or an empty string for media with no type specified.

    • Resolution: The DPI of the first image of the medium, or 0 for media with no resolution specified.

      Restriction: Only media whose horizontal and vertical resolution are equal are considered.

  • One of the following comparison operators:

    =  (the expression must match the property value)

    <>  (the expression must not match the property value)

  • A regular expression for matching the property value.

It is not necessary to enter all of the properties, and they can be used in any order. They are not case sensitive. Spaces between the parts are ignored.

Examples:

  • Total number of media:

    ""

  • Number of media with TIFF format:

    "Format=TIFF"

  • Number of media with TIFF or JPEG format and resolution not 300 DPI:

    "Format=(TIFF|JPEG), Resolution<>300"

  • Number of media with TIFF format named 001.tif that are associated with the "Invoice" document type and that have 300 DPI:

    "Format=TIFF, Name=001.tif, Type=Invoice, Resolution=300"

A ValidationResultCollection is returned. The validity status is True unless an exception occurs. If searchTerm is invalid, the validity status is set to False and the reason is reported in the message.

ClosedExtractString

This business rule extracts from the current field a string that matches the specified regular expression, and replaces the field value with the extracted string.

Parameters

Description

pValue

Value. Map this parameter to a varchar field.

pPattern

Regular expression.

ClosedFormatDate

This business rule changes the date value to a specified format.

Parameters

Description

pDate

A date value of type string.

pFormat

Format (for example "dd/MM/yyyy"). More information about standard date and time format strings (external link).

ClosedGetQueryData

This business rule retrieves data from a query, if the query delivers a single result. This rule fills the configured XBOUND fields with the query data if the query returns only one row.

For information about configuring a query, see Creating and testing a database query.

Parameters

Description

pContext

ValidationContext object (provided by the system; not configured by users).

pQueryName

Query name.

pTriggerField1 – pTriggerField10

Trigger field. (The field that triggers this query.) Trigger fields do not influence the query itself.

ClosedIsDate

This business rule checks whether if the specified value is a valid date. Country-specific settings are ignored.

Parameter

Description

pDate

A date value of type string.

ClosedIsDateFormat

This business rule checks whether the date fits the specified format.

Parameters

Description

pDate

A date value of type string.

pFormat

Format (for example "dd/MM/yyyy"). More information about standard date and time format strings (external link).

ClosedIsInDateRangeFromNow

Parameters

Description

pDate

A date value of type string.

pInterval

Date interval. Allowed values: 'd' = day; 'm' = month; 'y' = year; 'h' = hour; 'n' = minute; 's' = second; 'ms' = millisecond.

pCount

ClosedIsInDateRange_FixedFormat

This business rule checks if the date is within the specified interval. Note that parts of a new day, such as hours and minutes, are not considered.

Parameters

Description

pDate

A date value of type string.

pFormat

Format (for example "dd/MM/yyyy"). More information about standard date and time format strings (external link).

pInterval

Date interval. Allowed values: 'd' = day; 'm' = month; 'y' = year; 'h' = hour; 'n' = minute; 's' = second; 'ms' = millisecond.

pBeforeInterval

pAfterInterval

ClosedIsInIntegerRange

This business rule checks if current value is less than or equal to the minimum value and greater than or equal to the maximum value.

Parameters

Description

pValue

Value. Map this parameter to a varchar field.

pMinValue

Minimum value.

pMaxValue

Maximum value.

ClosedIsInQuery

This business rule checks if the document data can be found in the query result.

For information about configuring a query, see Creating and testing a database query.

Parameters

Description

pContext

ValidationContext object (provided by the system; not configured by users).

pQueryName

Query name.

pTriggerField1 – pTriggerField10

Trigger field. (The field that triggers this query.) Trigger fields do not influence the query itself.

ClosedIsNotInDateRangeFromNow

This business rule checks if the date is not within the specified interval with respect to the current date. (ClosedExample.)

This business rule transfers one or all barcodes to the field using a separator.

Parameters

Description

field

Field.

copyFirstBarcodeOnly

  • 0: All barcodes are transferred.

  • 1: Only first barcode is transferred.

separator

Separator.

Parameters

Description

pDate

A date value of type string.

pInterval

Date interval. Allowed values: 'd' = day; 'm' = month; 'y' = year; 'h' = hour; 'n' = minute; 's' = second; 'ms' = millisecond.

pCount

ClosedIsNullOrEmpty

This business rule checks if the value is filled in.

Parameter

Description

pValue

Value. Map this parameter to a varchar field.

ClosedIsNumeric

This business rule checks if value is numeric.

Parameter

Description

pValue

Value. Map this parameter to a varchar field.

ClosedMandatory

This business rule checks if the field is filled in.

Parameters

Description

pContext

ValidationContext object (provided by the system; not configured by users).

pField

Field.

ClosedRegExReplace

This business rule takes the value of a field (sourceField), replaces strings that match a regular expression (searchFor) with a replacement string (replaceBy), and saves the result in a field (targetField). The target field can be the same field or a different one.

Parameters

Description

sourceField

Source field.

targetField

Target field.

searchForThe regular expression to use.
replaceByNew format.
ignoreCaseIgnores differences in upper/lowercase letters.

Example 1: In this example the first name and last name are rearranged. "First Last" becomes "Last, First".

sourceField value: "John Doe"

searchFor: "(\w+) (\w+)"

replaceBy: "$2, $1"

targetField value: "Doe, John"

Example 2:

In this example, multiple spaces are reduced to one space:

sourceField: "Take    it      easy"

seachFor: " +"

replaceBy " "

targetField: "Take it easy"

ClosedRemoveCharacters

This business rule removes invalid characters.

Parameters

Description

pValue

Value. Map this parameter to a varchar field.

pInvalidCharacters

One or more invalid characters (no separator expected).

ClosedReplaceCharacters

This business rule replaces certain characters with specified new characters.

Example: pValue = "ABCDABCD", pOldCharacters="AC", pNewCharacters="1x"

Result: 1BxD1BxD

Parameters

Description

pValue

Value. Map this parameter to a varchar field.

pOldCharacters

Characters to be replaced.

pNewCharacters

Characters to replace the old ones.

ClosedResetShownInVerifierForAllFields

This business rule resets the ShownInVerifier status for all fields.

Parameters

Description

Context

ValidationContext object (provided by the system; not configured by users).

Field

Field.

ClosedResetValidForcedForAllFields

This business rule resets the ValidForced status for all fields.

Parameters

Description

Context

ValidationContext object (provided by the system; not configured by users).

Field

Field.

ClosedSetFieldsValidForcedForAllFields

This business rule sets all fields to the ValidForced status if the value of the trigger field matches the specified value.

Parameters

Description

Context

ValidationContext object (provided by the system; not configured by users).

Field

Field.

Value

If the field has this value, then the field is assigned the ValidForced status.

ClosedSetImageResolutionFromMedium

This business rule gets the resolution (DPI) of each medium (MIMETypes named "image/...") and saves it to the images of the medium (RCF properties HorizontalResolution and VerticalResolution).

If an error occurs when getting the resolution, it logs theerror and continues with the next medium. All other errors cause validation to fail.

Parameters

Description

context

ValidationContext object (provided by the system; not configured by users).

ClosedSetInvalid

This business rule sets the status of the field to Invalid.

Parameters

Description

pContext

ValidationContext object (provided by the system; not configured by users).

pFieldName

Field name.

ClosedSetValid

This business rule sets the status of the field to Valid.

Parameters

Description

pContext

ValidationContext object (provided by the system; not configured by users).

pFieldName

Field name.

ClosedSetValue

This business rule sets the field value.

Parameters

Description

pContext

ValidationContext object (provided by the system; not configured by users).

pFieldName

Field name.

pValue

New field value.

ClosedShowInVerifier – Date field

This business rule shows the selected field once in the Verification.

Parameters

Description

pContext

ValidationContext object (provided by the system; not configured by users).

pField

Field (DateTime).

ClosedShowInVerifier – Float field

This business rule shows the selected field once in the Verification.

Parameters

Description

pContext

ValidationContext object (provided by the system; not configured by users).

pField

Field (Float).

ClosedShowInVerifier – Integer field

This business rule shows the selected field once in the Verification.

Parameters

Description

pContext

ValidationContext object (provided by the system; not configured by users).

pField

Field (Int).

ClosedShowInVerifier – String field

This business rule shows the selected field once in the Verification.

Parameters

Description

pContext

ValidationContext object (provided by the system; not configured by users).

pField

Field.

ClosedShowUncertainExtractionResults

This business rule looks at the confidence rank (ConfidenceRank property) of the field value (FieldValue). If the rank is not "OK", the message from extraction (the CustomTag property) is displayed.

This allows the one-time presentation of a message optionally attached to a field. It can be used to display external validation messages in the Verification.

CustomTag must contain a semicolon-separated series of key value records. The keys and values must be separated by equal signs. The keys themselves must not contain equal signs, and the values must not contain semicolons.

The record used by the business rule must have "Message" as key. The value is the message to be displayed in Verification.

The business rule – if used – must be the first rule of the field.

Parameters

Description

pContext

ValidationContext object (provided by the system; not configured by users).

pField

Field.

ClosedSpellCheck

This business rule checks whether the field value contains spelling errors.

Parameters

Description

pContext

ValidationContext object (provided by the system; not configured by users).

pValue

The field.

pParameterSet

The process-level parameter set to use (see Saving spell-check settings for reuse in Verification process steps).

ClosedSplitFields

This business rule splits the source field using a separator, and it puts the parts into target fields.

Parameters

Description

pSourceField

Source field.

pSeparator

Separator.

pTargetField1

Target field.

pTargetField2

Target field, optional.

pTargetField3

Target field, optional.

pTargetField4

Target field, optional.

pTargetField5

Target field, optional.

ClosedToUpper

This business rule changes all letters to capital letters.

Parameter

Description

pValue

Value. Map this parameter to a varchar field.

Displaying, sorting, and filtering business rule templates