Skip to content

Language Reference, Decision Tables

Andreas AFENTAKIS edited this page Oct 28, 2025 · 3 revisions

This page is under authoring and review


Language Reference, Decision Tables

Purpose

The DecisionTables library provides functionality to implement and execute rule-based logic using tabular structures, known as Decision Tables. This allows complex, multi-factor decision-making (like credit scoring or rule engines) to be defined separately from the core program logic.


Quick Reference

Element Type Description
DTDIM Statement Defines a Decision Table
DTROW Statement Add a row to the Decision Table
DTFIND Statement Search the Descition Table
DTMAPPER Statement Change the default way that mappping functions are working
map() Function Performs a signle value mapping
dtmap() Function performs a signle value mapping, defining the key and value factors
FOUND Variable Getting the value True or False after search and mapping statements and functions

Statements

DTDIM (Dimension Definition)

Defines the structure of a new Decision Table, specifying its name, the default value to return if no rule matches, and the names of the factors (columns).

Syntax

DTDIM name, not_found_Value, factor1 [, factor2,] ... [,factorN]

Parameters

The factors list defines the columns of the table. The last factor in the list is always reserved for the return value of the table, while the preceding factors are the conditions.

Name Type Description Example
name String Literal The unique name of the Decision Table. SCard1
not_found_Value Value The default value to return if no rule (row) matches the query. 0
[factor1]...[factorN] Identifier The column headers (factors) for the table. The last one is the result factor. Age, PaymentHistory, Rank

Example

dtdim SCard1, 0, Age, PaymentHistory, Rank
rem Table name: SCard1, Default return: 0
rem Factors/Columns: Age (Condition), PaymentHistory (Condition), Rank (Result)

DTROW (Row Definition)

Adds a single rule (row) to a previously defined Decision Table. The values are matched in order against the factors defined in the DTDIM statement.

Syntax

DTROW name, factor1[, factor2,] ... [,factorN]

Parameters

Name Type Description Example
name String Literal The name of the Decision Table to add the row to. SCard1
[factor1]...[factorN] Value/Range The criteria for each condition factor, followed by the result value. 23:45, 0, 40
value Value/String The final value to be returned when all preceding criteria match. 40

Match Criteria Syntax

DTROW supports defining match criteria for factors:

Criterion Meaning Example
Specific Value Matches a single exact number. 0
Range Matches any value within a closed range (inclusive). 23:45 (Matches 23 to 45)
Greater Than/Equal Matches any value greater than or equal to. >=3
Less Than/Equal Matches any value less than or equal to. <22 or =<13
Wildcard Matches any value (implicitly used if a factor is irrelevant). * (or any single value if the DTFIND value is ignored)

Example

dtrow SCard1, 23:45, 0, 40
rem If Age is between 23 and 45 AND PaymentHistory is 0, the Rank is 40.

DTFIND (Decision Table Lookup)

Executes a lookup against a defined Decision Table using a set of input values for the condition factors.

Syntax

DTFIND name, resultFactor, VariableForTheFoundValue, [factor1], [factor2], ..., [factorN]

Parameters

Name Type Description Example
name String Literal The name of the Decision Table to search. SCard1
resultFactor Variable/Name The name of the factor (column) that contains the desired return value. Rank
VariableForTheFoundValue Variable The variable where the found return value will be stored. score1
[factor1]...[factorN] Variable/Value The input values to test against the condition factors of the table. age, missedPayments

Example

DTFIND SCard1, Rank, score1, age, missedPayments
rem Searches SCard1. If a matching row is found based on 'age' and 'missedPayments', the value in the 'Rank' column is stored in the 'score1' variable.

DTMAPPER (Simple Mapper Table)

Defines a Decision Table optimized for simple one-to-one mapping (lookup) where the table only contains a key factor and a value factor.

Syntax

DTMAPPER name, not_found_value, key_factor, value_factor

Functions

Decision Table functions are designed for quick lookups and return the result directly. They also update the system variable FIND.

map(DecTable, inValue)

Performs a simple mapping lookup on a two-column Decision Table (key and value). It is typically used for tables defined using DTMAPPER.

Syntax

map(DecTable,inValue)

Returns

The mapped value from the table, or the default value if no match is found.

dtmap(DecTable, value, key_factor_name, value_factor_name)

Performs a mapping lookup on a general Decision Table. You explicitly name the columns used for the key and the return value.

Syntax

dtmap(DecTable,value,key_factor_name,value_factor_name)

Returns

The mapped value from the table, or the default value if no match is found.


System Variable

FIND

This is a system-maintained Boolean variable that reflects the outcome of the last Decision Table lookup operation (DTFIND, map(), or dtmap()).

Variable Description
FIND TRUE if a matching row was successfully found by the last lookup operation; otherwise, FALSE.

Example

DTFIND SCard1, Rank, score1, age, missedPayments
IF FIND THEN 
    PRINT "Match found! Score is "; score1
ELSE 
    PRINT "No direct match, using default score."
END IF

Business Case

The business case demonstrates how the DecisionTables library can be used to implement the complex logic of a European retail bank's Customer Credit Scoring Card and integrate it into a loan application process.

The core capability is showing how multi-factor business rules (like Payment History, Credit Utilization, Age, etc.) are mapped into Decision Tables (DTDIM/DTROW) to calculate a Total Rank (score). The final score is then used in a separate table to determine the Decision (Automatic Reject, Manual Check, Automatic Approve), illustrating a structured, rule-based approach for embedding complex risk assessment logic into an automated lending service.

Read more about the case here

Clone this wiki locally