print a tag value

28 views
Skip to first unread message

acer

unread,
Feb 9, 2021, 9:50:33 PMFeb 9
to Ledger
What is the correct way to print the value of a tag in a report? For data:
2021/02/09  payname
  ; num: 1
  Asset:Account  $5.00
  Expense:Account

2021/02/08 otherpay
  ; num: 2
  Liability:Account  $150.00
  Income:Account  

How do I print the value of num in the report?  When trying 

reg --format " %(num) \\n"

I get this error message:

While calculating format expression:
  num
While evaluating value expression:
  num
  ^^^
While handling posting from " \Data\exam1.ledger", line 87:
> od  $100
> ;   As
> 2021/02/09  payname
>
Error: Unknown identifier 'num'

With the command:
reg --format " %num \\n"

I get:
Error: Unrecognized formatting character: n

Martin Michlmayr

unread,
Feb 9, 2021, 10:10:01 PMFeb 9
to ledge...@googlegroups.com
* acer <acer...@earthlink.net> [2021-02-09 18:50]:
> How do I print the value of num in the report? When trying
>
> reg --format " %(num) \\n"

reg --format " %(tag('num')) \\n"

--
Martin Michlmayr
https://www.cyrius.com/

acer

unread,
Feb 10, 2021, 7:09:24 PMFeb 10
to Ledger
Of course...

I guess I could have also escaped the quotes:
reg --format "%(tag(\"num\")) \\n"

Thanks!

Reply all
Reply to author
Forward
0 new messages