Using hyphens in commodity names

19 views
Skip to first unread message

Yashovardhan

unread,
Dec 27, 2021, 2:06:50 PM12/27/21
to Ledger
It seems like using hyphens (-) in commodity names causes ledger to have problems with limit and other queries.


Please let me know if there are any set of valid characters for commodity names. Currently, using underscore (_) instead of hyphen (-) seems to be a quick fix.

Thanks,
Yashovardhan

Martin Michlmayr

unread,
Dec 27, 2021, 6:55:23 PM12/27/21
to ledge...@googlegroups.com
* Yashovardhan <yashovardh...@gmail.com> [2021-12-27 11:06]:
> It seems like using hyphens (-) in commodity names causes ledger to
> have problems with limit and other queries.

> For example, ledger reg -l 'commodity == "ABC-Fund"' should output 3 postings but has no output.

In your query, the " quotation mark is used to quote the string. But
since it's a quoted commodity, you also need to specify the quotes for
the commodity. Therefore, you need two quotation marks, like this:

ledger -f d reg -l 'commodity == "\"ABC-Fund\""'

> Please let me know if there are any set of valid characters for
> commodity names. Currently, using underscore (_) instead of hyphen
> (-) seems to be a quick fix.

https://www.ledger-cli.org/3.0/doc/ledger3.html#Commoditized-Amounts

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

Yashovardhan

unread,
Dec 28, 2021, 7:58:22 AM12/28/21
to Ledger
Thanks a lot this seems to work!
Reply all
Reply to author
Forward
0 new messages