"John Wiegley" <jo...@newartisans.com> writes:

>>>>>> Eric Abrahamsen <e...@ericabrahamsen.net> writes:
>
>> Is it possible to see transaction metadata when doing matching for automated
>> transactions?
>
> Yes, if you start the automated transaction directive with "= expr ", then you
> can use any value expression, which includes "tag('NAME')", whose value is
> whatever the metadata tag as set to.

Okay, I'm nearly there, but not quite. My test data looks like this:

05/15 * Taxi
    ; Receipt: 40 RMB
    Expenses:Transportation                       23 RMB
    Assets:Cash

05/15 * BHG
    ; Receipt:
    Expenses:Food:Supermarket                    154 RMB
    Assets:Bank

I've got the simple case (just making an automated transaction when the
"Receipt" tag appears) working, with this:

= tag("Receipt") and /^expenses:(transportation|food|books)/
    (Assets:Receipts)                   1

My best guess for the complicated case (using the value of the Receipt
tag, when present, instead of the posting value) is this:

= expr recpt = tag("Receipt") and expr account =~ 
/^expenses:(transportation|food|books)/
    (Assets:Receipts)            ((recpt > 0) ? recpt : 1)

But running that gives me this error:

While parsing value expression:
  recpt = tag("Receipt"

While parsing automated transaction:
> = expr recpt = tag("Receipt") and expr account =~ 
> /^expenses:(transportation|food|books)/
Error: Invalid token '<end of input>' (wanted ')')

I'm not sure if this is a bug, or if I'm just writing it wrong. Should
it work as I've got it?

Thanks again,
Eric

-- 

--- 
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 ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to