Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

transform

Transform and analyze transaction data using Lisp programs.

Usage

kakei transform --program <LISP_PROGRAM>

Required Arguments

  • --program <LISP_PROGRAM>
    • A Lisp expression that transforms the transaction table
    • The variable table contains all transactions
    • See Lisp Functions for available functions

Description

The transform command is kakei's most powerful feature. It allows you to:

  • Filter transactions based on criteria
  • Group transactions by category, account, or custom logic
  • Perform calculations and aggregations
  • Extract specific transaction fields
  • Create custom reports

The transaction data is provided as a Lisp data structure in the table variable.

Examples

View All Transactions

kakei transform --program "table"

Group by Category

kakei transform --program "(group-by table (lambda (pair) (cdr (assoc 'category (cdr pair)))))"

Group by Account

kakei transform --program "(group-by table (lambda (pair) (cdr (assoc 'account (cdr pair)))))"

Get First Transaction Only

kakei transform --program "(cons (car table) ())"

Skip First Transaction

kakei transform --program "(cdr table)"

Get First Two Transactions

kakei transform --program "(cons (car table) (cons (car (cdr table)) ()))"

Shell Quoting

Be careful with shell quoting when passing Lisp programs:

POSIX shells:

kakei transform --program "(group-by table (lambda (pair) (cdr (assoc 'category (cdr pair)))))"

PowerShell:

kakei transform --program '(group-by table (lambda (pair) (cdr (assoc ''category'' (cdr pair)))))'

See Also

  • Data Format - Understanding transaction data structure
  • Lisp Functions - Complete reference of available Lisp functions
  • Examples - Real-world transformation examples