Printing notes in register/csv

80 views
Skip to first unread message

Tom Usher

unread,
May 8, 2012, 8:07:51 AM5/8/12
to ledge...@googlegroups.com
Is it possible to print the notes or tags associated with a posting when using the 'register' or 'csv' commands?

Craig Earls

unread,
May 8, 2012, 3:25:40 PM5/8/12
to ledge...@googlegroups.com
you have to use a custom format string. The default string doesn't
deal with the comments.

On Tue, May 8, 2012 at 8:07 AM, Tom Usher <4dmm...@gmail.com> wrote:
> Is it possible to print the notes or tags associated with a posting when
> using the 'register' or 'csv' commands?



--
Craig, Corona De Tucson, AZ
enderw88.wordpress.com

John Wiegley

unread,
May 8, 2012, 3:43:11 PM5/8/12
to ledge...@googlegroups.com
>>>>> Tom Usher <4dmm.tom-Re5JQE...@public.gmane.org> writes:

> Is it possible to print the notes or tags associated with a posting when
> using the 'register' or 'csv' commands?

Try --meta=foo. This should work for all reports.

John

John Wiegley

unread,
May 8, 2012, 7:31:56 PM5/8/12
to ledge...@googlegroups.com
>>>>> John Wiegley <jwiegley-Re5JQE...@public.gmane.org> writes:

> Try --meta=foo. This should work for all reports.

Use --prepend=note for regular comments (and also see --prepend-width).

John

Tom Usher

unread,
May 10, 2012, 1:46:41 PM5/10/12
to ledge...@googlegroups.com
Cheers for the reply John.

I can't get either of those to work unfortunately (using version 3.0.0-20120217).
Adding --meta=foo ('foo' I assume being a tag?) returns:
While calculating format expression:
  tag("shared")
While evaluating value expression:
  tag("shared")
  ^^^^^^^^^^^^^
Error: Unknown identifier 'tag'

While adding --prepend=note returns:
Error: Illegal option --prepend=note

Any suggestions?
Cheers,
Tom

On Wednesday, 9 May 2012 00:31:56 UTC+1, JohnW wrote:

John Wiegley

unread,
May 10, 2012, 5:26:10 PM5/10/12
to ledge...@googlegroups.com
>>>>> Tom Usher <4dmm.tom-Re5JQE...@public.gmane.org> writes:

> Cheers for the reply John. I can't get either of those to work
> unfortunately (using version 3.0.0-20120217). Adding --meta=foo ('foo' I
> assume being a tag?) returns: While calculating format expression:
> tag("shared")
> While evaluating value expression:
> tag("shared") ^^^^^^^^^^^^^
> Error: Unknown identifier 'tag'

Can you show me your exact command? It's possible this only works for
register reports, but not balance or print/equity reports.

> While adding --prepend=note returns: Error: Illegal option --prepend=note

Sorry, try this:

--prepend-format='%(note)'

John

Tom Usher

unread,
May 11, 2012, 4:20:56 AM5/11/12
to ledge...@googlegroups.com
Can you show me your exact command?  It's possible this only works for
register reports, but not balance or print/equity reports.
Yep, works fine with register commands - that was my intention, not sure how I ended up using balance!  

> While adding --prepend=note returns: Error: Illegal option --prepend=note

Sorry, try this:

    --prepend-format='%(note)'
Yep this works fine, thanks. 

John

Quick related question, now I know how useful that --meta option is, can I use the 'amount' variable from an automated transaction in meta data? Something like:
= Expenses:Home:Rent
  (Business:TaxDeductible) (amount*0.15)
  ; 15% of rent at $amount
  ; Total: $amount

John Wiegley

unread,
May 11, 2012, 3:59:33 PM5/11/12
to ledge...@googlegroups.com

John Wiegley

unread,
May 11, 2012, 4:00:28 PM5/11/12
to ledge...@googlegroups.com
>>>>> Tom Usher <4dmm.tom-Re5JQE...@public.gmane.org> writes:

> Quick related question, now I know how useful that --meta option is, can I
> use the 'amount' variable from an automated transaction in meta data?
> Something like:
>
> = Expenses:Home:Rent
> (Business:TaxDeductible) (amount*0.15)
> ; 15% of rent at $amount
> ; Total: $amount

For the metadata setting you can:

; Total:: amount

The "::" says that the value of the metadata key is a value expression.

John

rubén gómez

unread,
May 11, 2012, 4:32:01 PM5/11/12
to ledge...@googlegroups.com
Hi,
related to this:

John Wiegley <jwie...@gmail.com> escribió:
>
>For the metadata setting you can:
>
> ; Total:: amount
>
>The "::" says that the value of the metadata key is a value expression.
>
I saw in the manual that the expression should be:
; total:: [amount]

Could you explain the difference without the square braquets?
Thanks.

BTW: amazing piece of software :-)

John Wiegley

unread,
May 11, 2012, 6:16:25 PM5/11/12
to ledge...@googlegroups.com
>>>>> rubén gómez <ruben.gomez-+v4sr...@public.gmane.org> writes:

> I saw in the manual that the expression should be:
> ; total:: [amount]

> Could you explain the difference without the square braquets? Thanks.

The manual is wrong in this case. [] in a value expression introduces a
"literal date", i.e.:

; Date:: [2012/05/11]

This type of [] syntax is usable anywhere that value expressions are used.
For example, in an automated transaction's query expression (the "expr" causes
it to use full value expression syntax, not the more limited report query
syntax):

= expr date < [2012/05/11]

> BTW: amazing piece of software :-)

Thanks!!

John

rubén gómez

unread,
May 11, 2012, 6:56:27 PM5/11/12
to ledge...@googlegroups.com
Ok, thanks for the explanation.

John Wiegley <jwie...@gmail.com> escribió:


>
>The manual is wrong in this case. [] in a value expression introduces
>a
>"literal date", i.e.:
>
> ; Date:: [2012/05/11]
>

However I have all my tags with amounts with the [...] and the journal parses well. I suppose that interpretes them like years.

>This type of [] syntax is usable anywhere that value expressions are
>used.
>For example, in an automated transaction's query expression (the "expr"
>causes
>it to use full value expression syntax, not the more limited report
>query
>syntax):
>
> = expr date < [2012/05/11]
>

Good to know, this soft has infinity possibilities!


Tom Usher

unread,
May 12, 2012, 5:47:51 AM5/12/12
to ledge...@googlegroups.com
Thanks John.

This isn't quite working for some reason, my automated transaction looks like:
= Expenses:Home:Rent
   (Business:TaxDeductibles)   (amount*0.15)
   ; total:: amount

But when I run
ledger -f journal.ledger reg ^Business meta=total

The report looks like:
012-Apr-02 John Smith  (Busine:TaxDeductible)    £90.00    £90.00
(note the 0 at the start)

I've tried various debugging steps, like changing my metadata to "; total:: 100" and "; total: 100", both of which show:
10012-Apr-02 John Smith  (Busine:TaxDeductible)    £90.00    £90.00
in the report.

Just seems like amount is always 0 in those automated postings. Am I doing something wrong?

John Wiegley

unread,
May 12, 2012, 9:20:19 PM5/12/12
to ledge...@googlegroups.com
>>>>> Tom Usher <4dmm.tom-Re5JQE...@public.gmane.org> writes:

> The report looks like: 012-Apr-02 John Smith (Busine:TaxDeductible) £90.00
> £90.00 (note the 0 at the start)

I'll have to take a look at this. Thanks for bringing it to my attention.

John
Reply all
Reply to author
Forward
0 new messages