Skip to main content

Posting Matrix

The Posting Matrix is the visual interface for configuring the Accounting Rules Engine. It allows users to define rules that automatically assign GL dimensions to financial transactions.

Visual Structure Overview

┌──────────────────────────────────────────────────────────────────────────────────────────┐
│                                    POSTING MATRIX                                        │
├──────────────────────────────────────────────────────────────────────────────────────────┤
│                                                                                          │
│    ┌─────────────┐  ┌─────────────┐  ┌─────────────┐       ┌──────────────────────────┐ │
│    │  Column 1   │  │  Column 2   │  │  Column 3   │  ...  │     GL Dimension         │ │
│    │ (Criterion) │  │ (Criterion) │  │ (Criterion) │       │  (Target Account)        │ │
│    └─────────────┘  └─────────────┘  └─────────────┘       └──────────────────────────┘ │
│                                                                                          │
│    ┌─────────────────────────────────────────────────────────────────────────────────┐  │
│    │ RULE 1:   [= "shopify"]   [= "sale"]     [> "100"]        → Sales Revenue       │  │
│    ├─────────────────────────────────────────────────────────────────────────────────┤  │
│    │ RULE 2:   [= "shopify"]   [= "refund"]   [any]            → Refunds Expense     │  │
│    ├─────────────────────────────────────────────────────────────────────────────────┤  │
│    │ RULE 3:   [= "amazon"]    [any]          [any]            → Amazon Revenue      │  │
│    ├─────────────────────────────────────────────────────────────────────────────────┤  │
│    │ FALLBACK: [all]           [all]          [all]            → Unmatched Revenue   │  │
│    └─────────────────────────────────────────────────────────────────────────────────┘  │
│                                                                                          │
└──────────────────────────────────────────────────────────────────────────────────────────┘

Core Concepts

Column

A Column represents a field from transaction data that can be used to define criteria. Each column has a type that determines what data it accesses.
┌─────────────────────────────────────────┐
│               COLUMN                    │
├─────────────────────────────────────────┤
│  Name: "Sales Channel"                  │
│  Field Path: sales_channel              │
│  Field Type: string                     │
│                                         │
│  Used to create criteria that check     │
│  the sales_channel field in             │
│  transaction data                       │
└─────────────────────────────────────────┘
Examples of Columns:
  • Sales Channel (e.g., shopify, amazon)
  • Transaction Type (e.g., sale, refund)
  • Amount
  • Currency
  • Line Item Type

Rule

A Rule is a horizontal row in the matrix. It defines a set of conditions (criteria) that, when ALL are satisfied, assigns a specific GL dimension to the transaction.
┌──────────────────────────────────────────────────────────────────────────────────────┐
│                                    RULE                                              │
├──────────────────────────────────────────────────────────────────────────────────────┤
│                                                                                      │
│   ┌────────────────┐  ┌────────────────┐  ┌────────────────┐    ┌───────────────┐   │
│   │  Criterion 1   │  │  Criterion 2   │  │  Criterion 3   │ →  │ GL Dimension  │   │
│   │  [= "shopify"] │  │  [= "sale"]    │  │  [> "100"]     │    │ "4000 Sales"  │   │
│   └────────────────┘  └────────────────┘  └────────────────┘    └───────────────┘   │
│                                                                                      │
│   ▲                   ▲                   ▲                                          │
│   │                   │                   │                                          │
│   └───────────────────┴───────────────────┘                                          │
│                       │                                                              │
│              ALL criteria must match                                                 │
│              for this rule to apply                                                  │
│                                                                                      │
└──────────────────────────────────────────────────────────────────────────────────────┘
Rule Properties:
  • Order: Priority for rule evaluation (lower = higher priority)
  • Criteria: List of conditions (AND logic - all must match)
  • GL Dimension: Target account to assign when matched
  • Is Fallback: Special flag for catch-all rules

Criterion

A Criterion is the combination of an Operator and a Value applied to a specific column. It defines a single condition to check within a rule.
┌────────────────────────────────────────────────────────────────┐
│                         CRITERION                              │
│                   (Operator + Value)                           │
├────────────────────────────────────────────────────────────────┤
│                                                                │
│        OPERATOR       +         VALUE                          │
│        ┌──────┐                ┌──────────┐                    │
│        │  "=" │                │"shopify" │                    │
│        └──────┘                └──────────┘                    │
│            ↓                        ↓                          │
│       "how to                "what to                          │
│        compare"              compare against"                  │
│                                                                │
│   ════════════════════════════════════════════════════         │
│                                                                │
│   Applied to Column: "Sales Channel"                           │
│   Reads field: data.sales_channel                              │
│                                                                │
│   Result: TRUE if data.sales_channel === "shopify"             │
│                                                                │
│   Complete criterion: "= shopify" on Sales Channel column      │
│                                                                │
└────────────────────────────────────────────────────────────────┘

Operator

An Operator defines the comparison logic between the actual transaction data and the criterion value.
┌────────────────────────────────────────────────────────────────┐
│                        OPERATORS                               │
├────────────────────────────────────────────────────────────────┤
│                                                                │
│  EQUALITY                                                      │
│  ─────────                                                     │
│  =       equals              "shopify" = "shopify"    ✓        │
│  !=      not equals          "shopify" != "amazon"    ✓        │
│                                                                │
│  NUMERIC                                                       │
│  ───────                                                       │
│  >       greater than        150 > 100                ✓        │
│  <       less than           50 < 100                 ✓        │
│  >=      greater or equal    100 >= 100               ✓        │
│  <=      less or equal       100 <= 100               ✓        │
│                                                                │
│  STRING                                                        │
│  ──────                                                        │
│  *=      contains            "hello world" *=  "world" ✓       │
│  !*=     not contains        "hello" !*= "world"       ✓       │
│  ^=      starts with         "shopify" ^= "shop"       ✓       │
│  !^=     not starts with     "shopify" !^= "amaz"      ✓       │
│  $=      ends with           "shopify" $= "ify"        ✓       │
│  !$=     not ends with       "shopify" !$= "zon"       ✓       │
│                                                                │
│  SPECIAL                                                       │
│  ───────                                                       │
│  empty   is empty/null       "" empty                  ✓       │
│  !empty  is not empty        "value" !empty            ✓       │
│  all     always matches      (any) all                 ✓       │
│                                                                │
└────────────────────────────────────────────────────────────────┘

Value

A Value is the expected data to compare against when evaluating a criterion.
┌────────────────────────────────────────────────────────────────┐
│                          VALUE                                 │
├────────────────────────────────────────────────────────────────┤
│                                                                │
│  The value depends on the operator and column type:            │
│                                                                │
│  String values:    "shopify", "refund", "credit_card"          │
│  Numeric values:   "100", "0.08", "1000.50"                    │
│  Empty string:     "" (used with empty/!empty operators)       │
│                                                                │
│  Note: All values are stored as strings and converted          │
│  based on the column's field_type during evaluation.           │
│                                                                │
└────────────────────────────────────────────────────────────────┘

Complete Example

Here’s how all the concepts work together:
POSTING MATRIX: Revenue Account Assignment
═════════════════════════════════════════════════════════════════════════════════

COLUMNS:
┌─────────────────┐  ┌─────────────────┐  ┌─────────────────┐
│ Sales Channel   │  │ Transaction     │  │ Line Item       │
│ (string)        │  │ Type (string)   │  │ Type (string)   │
└─────────────────┘  └─────────────────┘  └─────────────────┘

RULES:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Rule 1 (order: 1)                                                           │
│                                                                             │
│  Sales Channel     Transaction Type    Line Item Type     → GL Dimension    │
│  ┌─────────────┐   ┌─────────────┐    ┌─────────────┐      ┌────────────┐  │
│  │ =  shopify  │ + │ =  sale     │ +  │ =  product  │  →   │ 4000 Sales │  │
│  └─────────────┘   └─────────────┘    └─────────────┘      └────────────┘  │
│                                                                             │
│  Matches: Shopify product sales → assigns to Sales account                  │
├─────────────────────────────────────────────────────────────────────────────┤
│ Rule 2 (order: 2)                                                           │
│                                                                             │
│  Sales Channel     Transaction Type    Line Item Type     → GL Dimension    │
│  ┌─────────────┐   ┌─────────────┐    ┌─────────────┐      ┌────────────┐  │
│  │ =  shopify  │ + │ =  sale     │ +  │ =  shipping │  →   │ 4100 Ship  │  │
│  └─────────────┘   └─────────────┘    └─────────────┘      └────────────┘  │
│                                                                             │
│  Matches: Shopify shipping charges → assigns to Shipping Revenue            │
├─────────────────────────────────────────────────────────────────────────────┤
│ Rule 3 (order: 3)                                                           │
│                                                                             │
│  Sales Channel     Transaction Type    Line Item Type     → GL Dimension    │
│  ┌─────────────┐   ┌─────────────┐    ┌─────────────┐      ┌────────────┐  │
│  │ =  shopify  │ + │ =  refund   │ +  │    all      │  →   │ 6100 Refund│  │
│  └─────────────┘   └─────────────┘    └─────────────┘      └────────────┘  │
│                                                                             │
│  Matches: All Shopify refunds → assigns to Refunds Expense                  │
├─────────────────────────────────────────────────────────────────────────────┤
│ Fallback Rule (order: 999)                                                  │
│                                                                             │
│  Sales Channel     Transaction Type    Line Item Type     → GL Dimension    │
│  ┌─────────────┐   ┌─────────────┐    ┌─────────────┐      ┌────────────┐  │
│  │    all      │ + │    all      │ +  │    all      │  →   │ 4999 Other │  │
│  └─────────────┘   └─────────────┘    └─────────────┘      └────────────┘  │
│                                                                             │
│  Catches any unmatched transactions → assigns to Other Revenue              │
└─────────────────────────────────────────────────────────────────────────────┘

EVALUATION:
  1. Rules are evaluated in order (lowest order first)
  2. ALL criteria in a rule must match for the rule to apply
  3. First matching rule determines the GL dimension
  4. Fallback rule catches anything that doesn't match above

Relationship Diagram

                          ┌─────────────────────────────────────┐
                          │          POSTING MATRIX             │
                          │     (Collection of Columns +        │
                          │      Rules for one Dimension)       │
                          └─────────────────────────────────────┘

                    ┌──────────────────────┼──────────────────────┐
                    │                      │                      │
                    ▼                      ▼                      ▼
           ┌───────────────┐      ┌───────────────┐      ┌───────────────┐
           │    COLUMN     │      │    COLUMN     │      │    COLUMN     │
           │ "Sales Chan"  │      │ "Trans Type"  │      │ "Amount"      │
           │ field: sales_ │      │ field: type   │      │ field: amount │
           │ channel       │      │               │      │               │
           └───────────────┘      └───────────────┘      └───────────────┘
                    │                      │                      │
                    │    ┌─────────────────┼──────────────────────┘
                    │    │                 │
                    ▼    ▼                 ▼
           ┌──────────────────────────────────────────────────────────────┐
           │                          RULE 1                              │
           │  ┌──────────────┐ ┌──────────────┐ ┌──────────────┐         │
           │  │  CRITERION   │ │  CRITERION   │ │  CRITERION   │  → GL   │
           │  │              │ │              │ │              │         │
           │  │ = "shopify"  │ │ = "sale"     │ │ > "100"      │         │
           │  │              │ │              │ │              │         │
           │  │ (operator +  │ │ (operator +  │ │ (operator +  │         │
           │  │  value)      │ │  value)      │ │  value)      │         │
           │  └──────────────┘ └──────────────┘ └──────────────┘         │
           └──────────────────────────────────────────────────────────────┘
           ┌──────────────────────────────────────────────────────────────┐
           │                          RULE 2                              │
           │                         (...)                                │
           └──────────────────────────────────────────────────────────────┘
           ┌──────────────────────────────────────────────────────────────┐
           │                     FALLBACK RULE                            │
           │  ┌──────────────┐ ┌──────────────┐ ┌──────────────┐         │
           │  │  CRITERION   │ │  CRITERION   │ │  CRITERION   │  → GL   │
           │  │   all match  │ │   all match  │ │   all match  │         │
           │  └──────────────┘ └──────────────┘ └──────────────┘         │
           └──────────────────────────────────────────────────────────────┘

Key Takeaways

ConceptDefinitionComponents
Posting MatrixUI for configuring accounting rulesColumns + Rules
ColumnA field from transaction dataField path, field type
RuleA row defining when to assign a GL dimensionMultiple Criteria + GL Dimension
CriterionA single condition combining operator + valueOperator + Value (applied to a Column)
OperatorHow to compare (=, !=, >, contains, etc.)Part of Criterion
ValueWhat to compare againstPart of Criterion
For detailed technical implementation and code examples, see the Accounting Rules Engine documentation.