I'm struggling to get my head around how to write value expressions with 
respect to automatic transactions

#+BEGIN_EXAMPLE
= /^Liabilities:CrushingDebt/ and (d > [2014/04/15])
 Assets:Checking  0.5
 Assets:RichUncle  -0.5


2014/04/01 * Foo
  Liabilities:CrushingDebt  $100
  Assets:Checking

2014/04/25 * Bar
  Liabilities:CrushingDebt  $150
  Assets:Checking

2014/04/25 * Unrelated
  Liabilities:TolerableDebt  $100
  Assets:Gubment

#+END_EXAMPLE

I'm getting:
ledger -f example.ledger bal
#+BEGIN_EXAMPLE
               $-400  Assets
               $-125    Checking
               $-150    Gubment
               $-125    RichUncle
                $400  Liabilities
                $250    CrushingDebt
                $150    TolerableDebt
--------------------
                   0
#+END_EXAMPLE

I was hoping for
#+BEGIN_EXAMPLE
               $-400  Assets
               $-175    Checking
               $-150    Gubment
                                $-75    RichUncle
                $400  Liabilities
                $250    CrushingDebt
                $150    TolerableDebt
--------------------
                   0
#+END_EXAMPLE

Pointers on how one debugs this sort of thing would be appreciated too.  I 
tried "--trace", but below 10 gives me no interesting information and above 9 
caused a segfault with the error:

#+BEGIN_EXAMPLE
terminate called after throwing an instance of 'std::logic_error'
  what():  Argument to --trace must be an integer
#+END_EXAMPLE

The ledger parse stuff seems to use a different syntax from the automatic 
stuff, as if I do a 

ledger parse "d>[2004/05/15]"
#+BEGIN_EXAMPLE
--- Context is first posting of the following transaction ---
2004/05/27 Book Store
    ; This note applies to all postings. :SecondTag:
    Expenses:Books                 20 BOOK @ $10
    ; Metadata: Some Value
    ; Typed:: $100 + $200
    ; :ExampleTag:
    ; Here follows a note describing the posting.
    Liabilities:MasterCard        $-200.00

--- Input expression ---
d>[2004/05/15]

--- Text as parsed ---
(d > [2004/05/15])

--- Expression tree ---
0xb6e710          O_GT (1)
0xb6e760           IDENT: d (1)
0xb6e860           VALUE: [2004/05/15] (1)

--- Compiled tree ---
0xb6c0f0          O_GT (1)
0xb6bcb0           IDENT: d (1)
0xb6bc60            FUNCTION (1)
0xb6e860           VALUE: [2004/05/15] (1)

--- Calculated value ---
true
#+END_EXAMPLE
It actually parses the date like I would expect, but the =/^Liabilities/ fails

ledger parse "=/^Liabilities/"

#+BEGIN_SRC
--- Context is first posting of the following transaction ---
2004/05/27 Book Store
    ; This note applies to all postings. :SecondTag:
    Expenses:Books                 20 BOOK @ $10
    ; Metadata: Some Value
    ; Typed:: $100 + $200
    ; :ExampleTag:
    ; Here follows a note describing the posting.
    Liabilities:MasterCard        $-200.00

--- Input expression ---
=/^Liabilities/

--- Text as parsed ---


--- Expression tree ---

--- Compiled tree ---

--- Calculated value ---
Error: Assertion failed in "/home/mcbeth/Source/Offsite/ledger/src/exprbase.h", 
line 182: ledger::expr_base_t<ResultType>::result_type 
ledger::expr_base_t<ResultType>::calc() [with ResultType = ledger::value_t; 
ledger::expr_base_t<ResultType>::result_type = ledger::value_t]: context
#+END_EXAMPLE

Hopefully this is enough information for someone to help me in my 
misunderstanding...

Jeff
-- 
"The man who does not read good books has no advantage over 
 the man who cannot read them."
 -- Mark Twain

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to