Rule Engine — Documentation
How to use the Command Box and write rules/formulas.
How to use the Rule Engine
The Command Box lets you write business rules without hard-coded logic. Use the Schema Explorer (left panel) to insert table.column names, and Global Constants for values like MIN_SALARY. Choose the rule type and output name in the toolbar, then write your rule or formula in the editor.
Use the Example Scripts dropdown on the Rule Engine page to load 1–2 sample scripts into the editor, then edit them as needed.
Syntax
- IF … THEN … ELSE — for Boolean (Pass/Fail) rules. Example:
IF condition THEN true ELSE false - AND, OR, NOT — combine conditions. Example:
income >= MIN_SALARY AND credit_score >= MIN_CREDIT_SCORE - >, <, >=, <= — comparison operators.
- Use
Table.column(e.g.Customer_Info.monthly_income) from the Schema Explorer. Click a table to expand columns, then click a column or constant to insert it at the cursor.
Formula builder
For ratios like DBR (Debt Burden Ratio), write expressions using +, -, *, / and parentheses.
Example:
(Customer_Info.existing_emi + Application.loan_emi) / Customer_Info.monthly_income * 100
Set Rule type to "Decimal" and give an Output name (e.g. dbr_ratio).
Output types
- Boolean — for eligibility (is_eligible), pass/fail.
- Integer — for tenure, scoring (credit_score_result).
- Decimal — for dbr_ratio, interest rate (calculated_irr).
- String — for policy_comment, reason_code, status.
Schema Explorer & Test Console
Schema Explorer (left): Click a table name to expand its columns. Click a column or a Global Constant to insert it at the current cursor position in the Rule/Formula editor.
Test Console (right): Enter a sample CNIC or Application ID, then click Run Test. The result area shows Pass/Fail and the output values (Boolean, Integer, Decimal, String) for that application.
Quick insert
Use the quick-insert buttons below the editor to add IF, AND, OR, NOT, >=, <=, >, <, and THEN true ELSE false at the cursor.