{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf460 {\fonttbl\f0\fmodern\fcharset0 Courier;} {\colortbl;\red255\green255\blue255;} \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\sl264\slmult1\ql\qnatural\pardirnatural \f0\fs28 \cf0 Value expressions are an expression language used by Ledger to\ calculate values used by the program for many different purposes:\ \ @enumerate\ @item\ The values displayed in reports\ @item\ For predicates (where truth is anything non-zero), to determine which\ postings are calculated (@option\{-l\}) or displayed (@option\{-d\}).\ @item\ For sorting criteria, to yield the sort key.\ @item\ In the matching criteria used by automated postings.\ @end enumerate\ \ Value expressions support most simple math and logic operators, in\ addition to a set of one letter functions and variables. A function's\ argument is whatever follows it. The following is a display predicate\ that I use with the @command\{balance\} command:\ \ @example\ ledger -d /^Liabilities/?T<0:UT>100 balance\ @end example\ \ The effect is that account totals are displayed only if: 1) A\ Liabilities account has a total less than zero; or 2) the absolute\ value of the account's total exceeds 100 units of whatever commodity\ contains. If it contains multiple commodities, only one of them must\ exceed 100 units.\ \ Display predicates are also very handy with register reports, to\ constrain which transactions are printed. For example, the following\ command shows only transactions from the beginning of the current month,\ while still calculating the running balance based on all transactions:\ \ @example\ ledger -d "d>[this month]" register checking\ @end example\ \ This advantage to this command's complexity is that it prints the\ running total in terms of all transactions in the register. The following,\ simpler command is similar, but totals only the displayed\ postings:\ \ @example\ ledger -b "this month" register checking\ @end example}