On Fri, 4 Jun 2021 at 19:47, Perl Ancar <[email protected]> wrote:

> ledger points out the wrong entry (probably the next entry with multiple 
> commas) when there is a misplaced comma. Example:
>
>     ; -*- Mode: ledger -*-
>
>     2021/01/06 entry1
>      assets:cash:savings:bca  200,0000 IDR
>      assets:cash:dana
>
>     2021/01/06 entry2
>      assets:cash:savings:bca  100,000 IDR
>      assets:cash:dana
>
>     2021/01/06 entry3
>      assets:cash:savings:bca  3,050,000 IDR
>      assets:cash:dana
>
> As you can see, the error is in entry1 in line 4. The amount should be 
> "200,000 IDR" (extraneous 0) or perhaps 2,000,000 IDR (misplaced commas).

How do you figure that?

Ledger is pretty flexible in its input syntax. In particular, it
supports both ‘.’ (American convention) and ‘,’ (European convention)
as the decimal separator. Absent any explicit indication in your file,
it probably interprets entry1 as a transaction for two hundred and
zero ten-thousandths, entry2 for one hundred and zero thousandths, and
entry3 as “three and fifty thousandths and wait, what? surely a number
cannot have two decimal separators”.

If you change the first occurrence of IDR this way:

    2021/01/06 entry1
      assets:cash:savings:bca  200,0000.00 IDR

then Ledger says:

    While parsing posting:
      assets:cash:savings:bca  200,0000.00 IDR
                               ^^^^^^^^^^^^^^^
    Error: Incorrect use of thousand-mark comma

I was under the impression that pre-declaring the commodity should
also have this effect, but I don’t see that having any effect on
Ledger 3.1.2:

    commodity IDR
      format 1,000.00 IDR

I also did not find a way to say that the comma is the thousand
separator and dot is the decimal separator without setting the default
precision to non-zero.

In my own use, I just don’t bother writing the thousand separators; a
typical day-to-day transaction in RUB is not large enough to warrant
digit grouping. But I see how you might want to, and how you might not
want decimals at all.

-- 

--- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/CAP_d_8VS_qA_8-XDMrp8CcUA3uZsEcsQBNyax2Dw3D9D0d8YJA%40mail.gmail.com.

Reply via email to