;doc: update manuals

This commit is contained in:
Simon Michael 2023-06-14 19:04:59 -10:00
parent f225bf2f7f
commit f660e03272
3 changed files with 423 additions and 326 deletions

View File

@ -6341,20 +6341,51 @@ quotes:
Regular expressions are also supported:
.RS 2
.PP
\f[V]\[dq]\[ha]expenses\[rs]b\[dq] \[dq]accounts (payable|receivable)\[dq]\f[R]
\f[V]\[dq]\[ha]expenses\[rs]b\[dq]\f[R]
.PD 0
.P
.PD
\f[V]\[dq]accounts (payable|receivable)\[dq]\f[R]
.RE
.IP \[bu] 2
Add a query type prefix to match other parts of the data:
.RS 2
.PP
\f[V]date:202312- desc:amazon cur:USD amt:\[dq]>100\[dq] status:\f[R]
\f[V]date:202312-\f[R]
.PD 0
.P
.PD
\f[V]status:\f[R]
.PD 0
.P
.PD
\f[V]desc:amazon\f[R]
.PD 0
.P
.PD
\f[V]cur:USD\f[R]
.PD 0
.P
.PD
\f[V]\[dq]amt:>0\[dq]\f[R]
.RE
.IP \[bu] 2
Add a \f[V]not:\f[R] prefix to negate a term:
Add a \f[V]not:\f[R] prefix to negate:
.RS 2
.PP
\f[V]not:cur:USD\f[R]
.RE
.IP \[bu] 2
Multiple unlike terms are AND-ed, multiple like terms are OR-ed
.RS 2
.PP
\f[V]date:2022 desc:amazon desc:amzn\f[R]
.PD 0
.P
.PD
(all transactions with \[dq]amazon\[dq] or \[dq]amzn\[dq] in description
during 2022)
.RE
.SS Query types
.PP
Here are the types of query term available.
@ -6440,6 +6471,14 @@ Match secondary dates within the specified period (independent of the
Match (or display, depending on command) accounts at or above this
depth.
.PP
\f[B]\f[VB]expr:\[dq]TERM AND NOT (TERM OR TERM)\[dq]\f[B]\f[R] (eg)
.PD 0
.P
.PD
Match with a boolean combination of queries (which must be enclosed in
quotes).
See Combining query terms below.
.PP
\f[B]\f[VB]note:REGEX\f[B]\f[R]
.PD 0
.P
@ -6584,13 +6623,15 @@ Normally, hledger groups and sums amounts within each account.
The \f[V]--pivot FIELD\f[R] option substitutes some other transaction
field for account names, causing amounts to be grouped and summed by
that field\[aq]s value instead.
FIELD can be any of the transaction fields \f[V]status\f[R],
\f[V]code\f[R], \f[V]description\f[R], \f[V]payee\f[R], \f[V]note\f[R],
or a tag name.
FIELD can be any of the transaction fields \f[V]acct\f[R],
\f[V]status\f[R], \f[V]code\f[R], \f[V]desc\f[R], \f[V]payee\f[R],
\f[V]note\f[R], or a tag name.
When pivoting on a tag and a posting has multiple values of that tag,
only the first value is displayed.
Values containing \f[V]colon:separated:parts\f[R] will be displayed
hierarchically, like account names.
Multiple, colon-delimited fields can be pivoted simultaneously,
generating a hierarchical account name.
.PP
Some examples:
.IP
@ -6598,7 +6639,7 @@ Some examples:
\f[C]
2016/02/16 Yearly Dues Payment
assets:bank account 2 EUR
income:dues -2 EUR ; member: John Doe
income:dues -2 EUR ; member: John Doe, kind: Lifetime
\f[R]
.fi
.PP
@ -6648,6 +6689,17 @@ $ hledger balance --pivot member acct:.
-2 EUR
\f[R]
.fi
.PP
Hierarchical reports can be generated with multiple pivots:
.IP
.nf
\f[C]
$ hledger balance Income:Dues --pivot kind:member
-2 EUR Lifetime:John Doe
--------------------
-2 EUR
\f[R]
.fi
.SH Generating data
.PP
hledger has several features for generating data, such as:

View File

@ -5580,16 +5580,27 @@ arguments to restrict their scope. The syntax is as follows:
* Regular expressions are also supported:
'"^expenses\b" "accounts (payable|receivable)"'
'"^expenses\b"'
'"accounts (payable|receivable)"'
* Add a query type prefix to match other parts of the data:
'date:202312- desc:amazon cur:USD amt:">100" status:'
'date:202312-'
'status:'
'desc:amazon'
'cur:USD'
'"amt:>0"'
* Add a 'not:' prefix to negate a term:
* Add a 'not:' prefix to negate:
'not:cur:USD'
* Multiple unlike terms are AND-ed, multiple like terms are OR-ed
'date:2022 desc:amazon desc:amzn'
(all transactions with "amazon" or "amzn" in description during
2022)
* Menu:
* Query types::
@ -5651,6 +5662,10 @@ Match secondary dates within the specified period (independent of the
Match (or display, depending on command) accounts at or above this
depth.
*'expr:"TERM AND NOT (TERM OR TERM)"'* (eg)
Match with a boolean combination of queries (which must be enclosed in
quotes). See Combining query terms below.
*'note:REGEX'*
Match transaction notes (the part of the description right of '|', or
the whole description if there's no '|').
@ -5784,17 +5799,19 @@ File: hledger.info, Node: Pivoting, Next: Generating data, Prev: Queries, Up
Normally, hledger groups and sums amounts within each account. The
'--pivot FIELD' option substitutes some other transaction field for
account names, causing amounts to be grouped and summed by that field's
value instead. FIELD can be any of the transaction fields 'status',
'code', 'description', 'payee', 'note', or a tag name. When pivoting on
a tag and a posting has multiple values of that tag, only the first
value instead. FIELD can be any of the transaction fields 'acct',
'status', 'code', 'desc', 'payee', 'note', or a tag name. When pivoting
on a tag and a posting has multiple values of that tag, only the first
value is displayed. Values containing 'colon:separated:parts' will be
displayed hierarchically, like account names.
displayed hierarchically, like account names. Multiple, colon-delimited
fields can be pivoted simultaneously, generating a hierarchical account
name.
Some examples:
2016/02/16 Yearly Dues Payment
assets:bank account 2 EUR
income:dues -2 EUR ; member: John Doe
income:dues -2 EUR ; member: John Doe, kind: Lifetime
Normal balance report showing account names:
@ -5827,6 +5844,13 @@ $ hledger balance --pivot member acct:.
--------------------
-2 EUR
Hierarchical reports can be generated with multiple pivots:
$ hledger balance Income:Dues --pivot kind:member
-2 EUR Lifetime:John Doe
--------------------
-2 EUR

File: hledger.info, Node: Generating data, Next: Forecasting, Prev: Pivoting, Up: Top
@ -11058,278 +11082,278 @@ Node: Depth197954
Ref: #depth198056
Node: Queries198352
Ref: #queries198454
Node: Query types199363
Ref: #query-types199484
Node: Combining query terms202658
Ref: #combining-query-terms202835
Node: Queries and command options204103
Ref: #queries-and-command-options204302
Node: Queries and valuation204551
Ref: #queries-and-valuation204746
Node: Querying with account aliases204975
Ref: #querying-with-account-aliases205186
Node: Querying with cost or value205316
Ref: #querying-with-cost-or-value205493
Node: Pivoting205794
Ref: #pivoting205908
Node: Generating data207366
Ref: #generating-data207498
Node: Forecasting209081
Ref: #forecasting209206
Node: --forecast209737
Ref: #forecast209868
Node: Inspecting forecast transactions210914
Ref: #inspecting-forecast-transactions211116
Node: Forecast reports212246
Ref: #forecast-reports212419
Node: Forecast tags213355
Ref: #forecast-tags213515
Node: Forecast period in detail213975
Ref: #forecast-period-in-detail214169
Node: Forecast troubleshooting215063
Ref: #forecast-troubleshooting215231
Node: Budgeting216134
Ref: #budgeting216254
Node: Cost reporting216691
Ref: #cost-reporting216819
Node: -B Convert to cost217926
Ref: #b-convert-to-cost218082
Node: Equity conversion postings219474
Ref: #equity-conversion-postings219688
Node: Inferring equity postings from cost220579
Ref: #inferring-equity-postings-from-cost220828
Node: Inferring cost from equity postings221639
Ref: #inferring-cost-from-equity-postings221887
Node: When to infer cost/equity223654
Ref: #when-to-infer-costequity223872
Node: How to record conversions224268
Ref: #how-to-record-conversions224460
Node: Conversion with implicit cost224751
Ref: #conversion-with-implicit-cost224956
Node: Conversion with explicit cost225833
Ref: #conversion-with-explicit-cost226078
Node: Conversion with equity postings226495
Ref: #conversion-with-equity-postings226764
Node: Conversion with equity postings and explicit cost227583
Ref: #conversion-with-equity-postings-and-explicit-cost227850
Node: Cost tips228312
Ref: #cost-tips228438
Node: Valuation229144
Ref: #valuation229268
Node: -V Value230042
Ref: #v-value230168
Node: -X Value in specified commodity230363
Ref: #x-value-in-specified-commodity230558
Node: Valuation date230707
Ref: #valuation-date230878
Node: Finding market price231315
Ref: #finding-market-price231520
Node: --infer-market-prices market prices from transactions232690
Ref: #infer-market-prices-market-prices-from-transactions232966
Node: Valuation commodity235722
Ref: #valuation-commodity235935
Node: Simple valuation examples237148
Ref: #simple-valuation-examples237346
Node: --value Flexible valuation238005
Ref: #value-flexible-valuation238209
Node: More valuation examples239853
Ref: #more-valuation-examples240062
Node: Interaction of valuation and queries242061
Ref: #interaction-of-valuation-and-queries242302
Node: Effect of valuation on reports242774
Ref: #effect-of-valuation-on-reports242971
Node: PART 4 COMMANDS250668
Ref: #part-4-commands250811
Node: Commands overview251190
Ref: #commands-overview251324
Node: DATA ENTRY251503
Ref: #data-entry251627
Node: DATA CREATION251826
Ref: #data-creation251980
Node: DATA MANAGEMENT252098
Ref: #data-management252263
Node: REPORTS FINANCIAL252384
Ref: #reports-financial252559
Node: REPORTS VERSATILE252864
Ref: #reports-versatile253037
Node: REPORTS BASIC253290
Ref: #reports-basic253442
Node: HELP253951
Ref: #help254073
Node: ADD-ONS254183
Ref: #add-ons254289
Node: accounts254868
Ref: #accounts255001
Node: activity256888
Ref: #activity257007
Node: add257381
Ref: #add257491
Node: aregister260302
Ref: #aregister260423
Node: aregister and custom posting dates263311
Ref: #aregister-and-custom-posting-dates263477
Node: balance264029
Ref: #balance264155
Node: balance features265130
Ref: #balance-features265270
Node: Simple balance report267229
Ref: #simple-balance-report267414
Node: Balance report line format269039
Ref: #balance-report-line-format269241
Node: Filtered balance report271399
Ref: #filtered-balance-report271591
Node: List or tree mode271918
Ref: #list-or-tree-mode272086
Node: Depth limiting273431
Ref: #depth-limiting273597
Node: Dropping top-level accounts274198
Ref: #dropping-top-level-accounts274398
Node: Showing declared accounts274708
Ref: #showing-declared-accounts274907
Node: Sorting by amount275438
Ref: #sorting-by-amount275605
Node: Percentages276275
Ref: #percentages276434
Node: Multi-period balance report276982
Ref: #multi-period-balance-report277182
Node: Balance change end balance279457
Ref: #balance-change-end-balance279666
Node: Balance report types281094
Ref: #balance-report-types281275
Node: Calculation type281773
Ref: #calculation-type281928
Node: Accumulation type282477
Ref: #accumulation-type282657
Node: Valuation type283559
Ref: #valuation-type283747
Node: Combining balance report types284742
Ref: #combining-balance-report-types284936
Node: Budget report286774
Ref: #budget-report286926
Node: Budget report start date292580
Ref: #budget-report-start-date292758
Node: Budgets and subaccounts294090
Ref: #budgets-and-subaccounts294297
Node: Selecting budget goals297737
Ref: #selecting-budget-goals297936
Node: Budget vs forecast298971
Ref: #budget-vs-forecast299130
Node: Data layout300760
Ref: #data-layout300910
Node: Useful balance reports308805
Ref: #useful-balance-reports308955
Node: balancesheet310040
Ref: #balancesheet310185
Node: balancesheetequity311505
Ref: #balancesheetequity311663
Node: cashflow313052
Ref: #cashflow313183
Node: check314611
Ref: #check314725
Node: Basic checks315527
Ref: #basic-checks315647
Node: Strict checks316167
Ref: #strict-checks316310
Node: Other checks316733
Ref: #other-checks316875
Node: Custom checks317438
Ref: #custom-checks317595
Node: More about specific checks318012
Ref: #more-about-specific-checks318174
Node: close318902
Ref: #close319013
Node: close and balance assertions322478
Ref: #close-and-balance-assertions322656
Node: Example retain earnings323807
Ref: #example-retain-earnings324024
Node: Example migrate balances to a new file324456
Ref: #example-migrate-balances-to-a-new-file324721
Node: Example excluding closing/opening transactions325297
Ref: #example-excluding-closingopening-transactions325546
Node: codes326764
Ref: #codes326881
Node: commodities327745
Ref: #commodities327873
Node: demo327943
Ref: #demo328064
Node: descriptions328980
Ref: #descriptions329110
Node: diff329401
Ref: #diff329516
Node: files330558
Ref: #files330667
Node: help330808
Ref: #help-1330917
Node: import332290
Ref: #import332413
Node: Deduplication333499
Ref: #deduplication333624
Node: Import testing335518
Ref: #import-testing335683
Node: Importing balance assignments336526
Ref: #importing-balance-assignments336732
Node: Commodity display styles337381
Ref: #commodity-display-styles337554
Node: incomestatement337683
Ref: #incomestatement337825
Node: notes339146
Ref: #notes339268
Node: payees339630
Ref: #payees339745
Node: prices340264
Ref: #prices340379
Node: print340677
Ref: #print340792
Node: register346130
Ref: #register346252
Node: Custom register output351283
Ref: #custom-register-output351414
Node: rewrite352751
Ref: #rewrite352869
Node: Re-write rules in a file354767
Ref: #re-write-rules-in-a-file354930
Node: Diff output format356079
Ref: #diff-output-format356262
Node: rewrite vs print --auto357354
Ref: #rewrite-vs.-print---auto357514
Node: roi358070
Ref: #roi358177
Node: Spaces and special characters in --inv and --pnl359898
Ref: #spaces-and-special-characters-in---inv-and---pnl360138
Node: Semantics of --inv and --pnl360626
Ref: #semantics-of---inv-and---pnl360865
Node: IRR and TWR explained362715
Ref: #irr-and-twr-explained362875
Node: stats365961
Ref: #stats366069
Node: tags367456
Ref: #tags-1367563
Node: test368572
Ref: #test368665
Node: PART 5 COMMON TASKS369407
Ref: #part-5-common-tasks369553
Node: Getting help369851
Ref: #getting-help369992
Node: Constructing command lines370752
Ref: #constructing-command-lines370953
Node: Starting a journal file371610
Ref: #starting-a-journal-file371812
Node: Setting LEDGER_FILE373014
Ref: #setting-ledger_file373206
Node: Setting opening balances374163
Ref: #setting-opening-balances374364
Node: Recording transactions377505
Ref: #recording-transactions377694
Node: Reconciling378250
Ref: #reconciling378402
Node: Reporting380659
Ref: #reporting380808
Node: Migrating to a new file384793
Ref: #migrating-to-a-new-file384950
Node: BUGS385249
Ref: #bugs385339
Node: Troubleshooting386218
Ref: #troubleshooting386318
Node: Query types199579
Ref: #query-types199700
Node: Combining query terms203036
Ref: #combining-query-terms203213
Node: Queries and command options204481
Ref: #queries-and-command-options204680
Node: Queries and valuation204929
Ref: #queries-and-valuation205124
Node: Querying with account aliases205353
Ref: #querying-with-account-aliases205564
Node: Querying with cost or value205694
Ref: #querying-with-cost-or-value205871
Node: Pivoting206172
Ref: #pivoting206286
Node: Generating data208063
Ref: #generating-data208195
Node: Forecasting209778
Ref: #forecasting209903
Node: --forecast210434
Ref: #forecast210565
Node: Inspecting forecast transactions211611
Ref: #inspecting-forecast-transactions211813
Node: Forecast reports212943
Ref: #forecast-reports213116
Node: Forecast tags214052
Ref: #forecast-tags214212
Node: Forecast period in detail214672
Ref: #forecast-period-in-detail214866
Node: Forecast troubleshooting215760
Ref: #forecast-troubleshooting215928
Node: Budgeting216831
Ref: #budgeting216951
Node: Cost reporting217388
Ref: #cost-reporting217516
Node: -B Convert to cost218623
Ref: #b-convert-to-cost218779
Node: Equity conversion postings220171
Ref: #equity-conversion-postings220385
Node: Inferring equity postings from cost221276
Ref: #inferring-equity-postings-from-cost221525
Node: Inferring cost from equity postings222336
Ref: #inferring-cost-from-equity-postings222584
Node: When to infer cost/equity224351
Ref: #when-to-infer-costequity224569
Node: How to record conversions224965
Ref: #how-to-record-conversions225157
Node: Conversion with implicit cost225448
Ref: #conversion-with-implicit-cost225653
Node: Conversion with explicit cost226530
Ref: #conversion-with-explicit-cost226775
Node: Conversion with equity postings227192
Ref: #conversion-with-equity-postings227461
Node: Conversion with equity postings and explicit cost228280
Ref: #conversion-with-equity-postings-and-explicit-cost228547
Node: Cost tips229009
Ref: #cost-tips229135
Node: Valuation229841
Ref: #valuation229965
Node: -V Value230739
Ref: #v-value230865
Node: -X Value in specified commodity231060
Ref: #x-value-in-specified-commodity231255
Node: Valuation date231404
Ref: #valuation-date231575
Node: Finding market price232012
Ref: #finding-market-price232217
Node: --infer-market-prices market prices from transactions233387
Ref: #infer-market-prices-market-prices-from-transactions233663
Node: Valuation commodity236419
Ref: #valuation-commodity236632
Node: Simple valuation examples237845
Ref: #simple-valuation-examples238043
Node: --value Flexible valuation238702
Ref: #value-flexible-valuation238906
Node: More valuation examples240550
Ref: #more-valuation-examples240759
Node: Interaction of valuation and queries242758
Ref: #interaction-of-valuation-and-queries242999
Node: Effect of valuation on reports243471
Ref: #effect-of-valuation-on-reports243668
Node: PART 4 COMMANDS251365
Ref: #part-4-commands251508
Node: Commands overview251887
Ref: #commands-overview252021
Node: DATA ENTRY252200
Ref: #data-entry252324
Node: DATA CREATION252523
Ref: #data-creation252677
Node: DATA MANAGEMENT252795
Ref: #data-management252960
Node: REPORTS FINANCIAL253081
Ref: #reports-financial253256
Node: REPORTS VERSATILE253561
Ref: #reports-versatile253734
Node: REPORTS BASIC253987
Ref: #reports-basic254139
Node: HELP254648
Ref: #help254770
Node: ADD-ONS254880
Ref: #add-ons254986
Node: accounts255565
Ref: #accounts255698
Node: activity257585
Ref: #activity257704
Node: add258078
Ref: #add258188
Node: aregister260999
Ref: #aregister261120
Node: aregister and custom posting dates264008
Ref: #aregister-and-custom-posting-dates264174
Node: balance264726
Ref: #balance264852
Node: balance features265827
Ref: #balance-features265967
Node: Simple balance report267926
Ref: #simple-balance-report268111
Node: Balance report line format269736
Ref: #balance-report-line-format269938
Node: Filtered balance report272096
Ref: #filtered-balance-report272288
Node: List or tree mode272615
Ref: #list-or-tree-mode272783
Node: Depth limiting274128
Ref: #depth-limiting274294
Node: Dropping top-level accounts274895
Ref: #dropping-top-level-accounts275095
Node: Showing declared accounts275405
Ref: #showing-declared-accounts275604
Node: Sorting by amount276135
Ref: #sorting-by-amount276302
Node: Percentages276972
Ref: #percentages277131
Node: Multi-period balance report277679
Ref: #multi-period-balance-report277879
Node: Balance change end balance280154
Ref: #balance-change-end-balance280363
Node: Balance report types281791
Ref: #balance-report-types281972
Node: Calculation type282470
Ref: #calculation-type282625
Node: Accumulation type283174
Ref: #accumulation-type283354
Node: Valuation type284256
Ref: #valuation-type284444
Node: Combining balance report types285439
Ref: #combining-balance-report-types285633
Node: Budget report287471
Ref: #budget-report287623
Node: Budget report start date293277
Ref: #budget-report-start-date293455
Node: Budgets and subaccounts294787
Ref: #budgets-and-subaccounts294994
Node: Selecting budget goals298434
Ref: #selecting-budget-goals298633
Node: Budget vs forecast299668
Ref: #budget-vs-forecast299827
Node: Data layout301457
Ref: #data-layout301607
Node: Useful balance reports309502
Ref: #useful-balance-reports309652
Node: balancesheet310737
Ref: #balancesheet310882
Node: balancesheetequity312202
Ref: #balancesheetequity312360
Node: cashflow313749
Ref: #cashflow313880
Node: check315308
Ref: #check315422
Node: Basic checks316224
Ref: #basic-checks316344
Node: Strict checks316864
Ref: #strict-checks317007
Node: Other checks317430
Ref: #other-checks317572
Node: Custom checks318135
Ref: #custom-checks318292
Node: More about specific checks318709
Ref: #more-about-specific-checks318871
Node: close319599
Ref: #close319710
Node: close and balance assertions323175
Ref: #close-and-balance-assertions323353
Node: Example retain earnings324504
Ref: #example-retain-earnings324721
Node: Example migrate balances to a new file325153
Ref: #example-migrate-balances-to-a-new-file325418
Node: Example excluding closing/opening transactions325994
Ref: #example-excluding-closingopening-transactions326243
Node: codes327461
Ref: #codes327578
Node: commodities328442
Ref: #commodities328570
Node: demo328640
Ref: #demo328761
Node: descriptions329677
Ref: #descriptions329807
Node: diff330098
Ref: #diff330213
Node: files331255
Ref: #files331364
Node: help331505
Ref: #help-1331614
Node: import332987
Ref: #import333110
Node: Deduplication334196
Ref: #deduplication334321
Node: Import testing336215
Ref: #import-testing336380
Node: Importing balance assignments337223
Ref: #importing-balance-assignments337429
Node: Commodity display styles338078
Ref: #commodity-display-styles338251
Node: incomestatement338380
Ref: #incomestatement338522
Node: notes339843
Ref: #notes339965
Node: payees340327
Ref: #payees340442
Node: prices340961
Ref: #prices341076
Node: print341374
Ref: #print341489
Node: register346827
Ref: #register346949
Node: Custom register output351980
Ref: #custom-register-output352111
Node: rewrite353448
Ref: #rewrite353566
Node: Re-write rules in a file355464
Ref: #re-write-rules-in-a-file355627
Node: Diff output format356776
Ref: #diff-output-format356959
Node: rewrite vs print --auto358051
Ref: #rewrite-vs.-print---auto358211
Node: roi358767
Ref: #roi358874
Node: Spaces and special characters in --inv and --pnl360595
Ref: #spaces-and-special-characters-in---inv-and---pnl360835
Node: Semantics of --inv and --pnl361323
Ref: #semantics-of---inv-and---pnl361562
Node: IRR and TWR explained363412
Ref: #irr-and-twr-explained363572
Node: stats366658
Ref: #stats366766
Node: tags368153
Ref: #tags-1368260
Node: test369269
Ref: #test369362
Node: PART 5 COMMON TASKS370104
Ref: #part-5-common-tasks370250
Node: Getting help370548
Ref: #getting-help370689
Node: Constructing command lines371449
Ref: #constructing-command-lines371650
Node: Starting a journal file372307
Ref: #starting-a-journal-file372509
Node: Setting LEDGER_FILE373711
Ref: #setting-ledger_file373903
Node: Setting opening balances374860
Ref: #setting-opening-balances375061
Node: Recording transactions378202
Ref: #recording-transactions378391
Node: Reconciling378947
Ref: #reconciling379099
Node: Reporting381356
Ref: #reporting381505
Node: Migrating to a new file385490
Ref: #migrating-to-a-new-file385647
Node: BUGS385946
Ref: #bugs386036
Node: Troubleshooting386915
Ref: #troubleshooting387015

End Tag Table

View File

@ -4485,16 +4485,26 @@ Queries
o Regular expressions are also supported:
"^expenses\b" "accounts (payable|receivable)"
"^expenses\b"
"accounts (payable|receivable)"
o Add a query type prefix to match other parts of the data:
date:202312- desc:amazon cur:USD amt:">100" status:
date:202312-
status:
desc:amazon
cur:USD
"amt:>0"
o Add a not: prefix to negate a term:
o Add a not: prefix to negate:
not:cur:USD
o Multiple unlike terms are AND-ed, multiple like terms are OR-ed
date:2022 desc:amazon desc:amzn
(all transactions with "amazon" or "amzn" in description during 2022)
Query types
Here are the types of query term available. Remember these can also be
prefixed with not: to convert them into a negative match.
@ -4541,12 +4551,16 @@ Queries
Match (or display, depending on command) accounts at or above this
depth.
expr:"TERM AND NOT (TERM OR TERM)" (eg)
Match with a boolean combination of queries (which must be enclosed in
quotes). See Combining query terms below.
note:REGEX
Match transaction notes (the part of the description right of |, or the
whole description if there's no |).
payee:REGEX
Match transaction payee/payer names (the part of the description left
Match transaction payee/payer names (the part of the description left
of |, or the whole description if there's no |).
real:, real:0
@ -4556,11 +4570,11 @@ Queries
Match unmarked, pending, or cleared transactions respectively.
type:TYPECODES
Match by account type (see Declaring accounts > Account types). TYPE-
CODES is one or more of the single-letter account type codes ALERXCV,
Match by account type (see Declaring accounts > Account types). TYPE-
CODES is one or more of the single-letter account type codes ALERXCV,
case insensitive. Note type:A and type:E will also match their respec-
tive subtypes C (Cash) and V (Conversion). Certain kinds of account
alias can disrupt account types, see Rewriting accounts > Aliases and
tive subtypes C (Cash) and V (Conversion). Certain kinds of account
alias can disrupt account types, see Rewriting accounts > Aliases and
account types.
tag:REGEX[=REGEX]
@ -4576,11 +4590,11 @@ Queries
o Transactions also acquire the tags of their postings.
(inacct:ACCTNAME
A special query term used automatically in hledger-web only: tells
A special query term used automatically in hledger-web only: tells
hledger-web to show the transaction register for an account.)
Combining query terms
When given multiple space-separated query terms, most commands select
When given multiple space-separated query terms, most commands select
things which match:
o any of the description terms AND
@ -4601,13 +4615,13 @@ Queries
o match all the other terms.
We also support more complex boolean queries with the 'expr:' prefix.
This allows one to combine queries using one of three operators: AND,
We also support more complex boolean queries with the 'expr:' prefix.
This allows one to combine queries using one of three operators: AND,
OR, and NOT, where NOT is different syntax for 'not:'.
Examples of such queries are:
o Match transactions with 'cool' in the description AND with the 'A'
o Match transactions with 'cool' in the description AND with the 'A'
tag
expr:"desc:cool AND tag:A"
@ -4617,22 +4631,22 @@ Queries
expr:"NOT expenses:food OR tag:A"
o Match transactions NOT involving the 'expenses:food' account OR with
the 'A' tag AND involving the 'expenses:drink' account. (the AND is
o Match transactions NOT involving the 'expenses:food' account OR with
the 'A' tag AND involving the 'expenses:drink' account. (the AND is
implicitly added by space-separation, following the rules above)
expr:"expenses:food OR (tag:A expenses:drink)"
Queries and command options
Some queries can also be expressed as command-line options: depth:2 is
Some queries can also be expressed as command-line options: depth:2 is
equivalent to --depth 2, date:2023 is equivalent to -p 2023, etc. When
you mix command options and query arguments, generally the resulting
you mix command options and query arguments, generally the resulting
query is their intersection.
Queries and valuation
When amounts are converted to other commodities in cost or value re-
ports, cur: and amt: match the old commodity symbol and the old amount
quantity, not the new ones (except in hledger 1.22.0 where it's re-
When amounts are converted to other commodities in cost or value re-
ports, cur: and amt: match the old commodity symbol and the old amount
quantity, not the new ones (except in hledger 1.22.0 where it's re-
versed, see #1625).
Querying with account aliases
@ -4640,27 +4654,28 @@ Queries
will match either the old or the new account name.
Querying with cost or value
When amounts are converted to other commodities in cost or value re-
When amounts are converted to other commodities in cost or value re-
ports, note that cur: matches the new commodity symbol, and not the old
one, and amt: matches the new quantity, and not the old one. Note:
this changed in hledger 1.22, previously it was the reverse, see the
one, and amt: matches the new quantity, and not the old one. Note:
this changed in hledger 1.22, previously it was the reverse, see the
discussion at #1625.
Pivoting
Normally, hledger groups and sums amounts within each account. The
--pivot FIELD option substitutes some other transaction field for ac-
count names, causing amounts to be grouped and summed by that field's
value instead. FIELD can be any of the transaction fields status,
code, description, payee, note, or a tag name. When pivoting on a tag
and a posting has multiple values of that tag, only the first value is
displayed. Values containing colon:separated:parts will be displayed
hierarchically, like account names.
Normally, hledger groups and sums amounts within each account. The
--pivot FIELD option substitutes some other transaction field for ac-
count names, causing amounts to be grouped and summed by that field's
value instead. FIELD can be any of the transaction fields acct, sta-
tus, code, desc, payee, note, or a tag name. When pivoting on a tag
and a posting has multiple values of that tag, only the first value is
displayed. Values containing colon:separated:parts will be displayed
hierarchically, like account names. Multiple, colon-delimited fields
can be pivoted simultaneously, generating a hierarchical account name.
Some examples:
2016/02/16 Yearly Dues Payment
assets:bank account 2 EUR
income:dues -2 EUR ; member: John Doe
income:dues -2 EUR ; member: John Doe, kind: Lifetime
Normal balance report showing account names:
@ -4693,6 +4708,13 @@ Pivoting
--------------------
-2 EUR
Hierarchical reports can be generated with multiple pivots:
$ hledger balance Income:Dues --pivot kind:member
-2 EUR Lifetime:John Doe
--------------------
-2 EUR
Generating data
hledger has several features for generating data, such as:
@ -5604,6 +5626,12 @@ Valuation
posting cost value at re- value at posting value at re- value at
amounts port or date port or DATE/today
journal end journal end
summary summarised value at pe- sum of postings value at pe- value at
posting cost riod ends in interval, val- riod ends DATE/today
amounts ued at interval
@ -5617,10 +5645,6 @@ Valuation
balance
(bs, bse,
cf, is)
balance sums of value at re- value at posting value at re- value at
changes costs port end or date port or DATE/today of
today of journal end sums of post-
@ -6534,9 +6558,6 @@ PART 4: COMMANDS
period end ues from report from report report start
start to period start to period to period end
end end
--his- change from sum of posting- period-end DATE-value of
torical journal start to date market val- value of change change from
/-H period end (his- ues from journal from journal journal start