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

View File

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