Resetting a balance is illegal?

241 views
Skip to first unread message

John Louis Del Rosario

unread,
Nov 23, 2014, 10:52:27 PM11/23/14
to ledge...@googlegroups.com
I just tried to reset a balance (http://ledger-cli.org/3.0/doc/ledger3.html#Resetting-a-balance), but it seems it's illegal?

11/24 * Adjustment
    Liabilities:Credit:Metrobank   = P 0.00
    Equity:Adjustments


Error: Only one posting with null amount allowed per transaction

I'm using Ledger 3.1.0-20141005 on OS X.

Craig Earls

unread,
Nov 24, 2014, 9:25:52 AM11/24/14
to ledge...@googlegroups.com
Not sure what is going on.  If I use a $ sign instead of the "P" you are using, this works fine.  Try putting the "P" after the 0.00. 

--

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



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

John Louis Del Rosario

unread,
Nov 25, 2014, 3:07:51 AM11/25/14
to ledge...@googlegroups.com
Tried both $ and putting P after the amount, but still got the error.
e.g.
11/24 * Adjustment
    Liabilities:Credit:Metrobank   = 0.00 P
    Equity:Adjustments


Here are my heading declartions if it matters:

include Accounts.ledger
include Tags.ledger

commodity P
    default

year 2014

bucket Assets:Cash

Thanks.

Craig Earls

unread,
Nov 25, 2014, 9:11:16 AM11/25/14
to ledge...@googlegroups.com
Something else is happening. I made up a test file using the xact and declarations you gave and I get the expected results. 

What editor are you using? 

Daniël Bos (远洋)

unread,
Nov 25, 2014, 9:47:30 AM11/25/14
to ledge...@googlegroups.com
Using:

2014/01/01 * a
  a  = 0.00
  b

As a test on my (pretty old) build on Ubuntu, I'm seeing the same:

Ledger 3.0.0-20120518, the command-line accounting tool

Copyright (c) 2003-2013, John Wiegley.  All rights reserved.

This program is made available under the terms of the BSD Public License.
See LICENSE file included with the distribution for details and disclaimer.
While parsing file "test.ledger", line 3: 
Error: Only one posting with null amount allowed per transaction

However, if I first book something (other than null) to "a", the error goes away. I'm not entirely convinced this is a bug, I'll leave that up to Craig/John to decide.

Best regards,
Daniel Bos

Craig Earls

unread,
Nov 25, 2014, 12:15:59 PM11/25/14
to ledge...@googlegroups.com
I can confirm that I see the error if there is only one transaction affecting the account and that transaction is resetting it to 0.  Since a single transaction setting an account to zero is pretty useless I don't see this as a bug.

Daniël Bos (远洋)

unread,
Nov 25, 2014, 7:36:03 PM11/25/14
to ledge...@googlegroups.com
Hi Craig,

That's not entirely true. This issue occurs when you try to reset an account that is already null.

Craig Earls

unread,
Nov 25, 2014, 8:18:50 PM11/25/14
to ledge...@googlegroups.com
You are right. That is a better way of saying it. 

John Louis Del Rosario

unread,
Nov 25, 2014, 9:01:52 PM11/25/14
to ledge...@googlegroups.com
But both my "Liabilities:Credit:Metrobank" and "Equity:Adjustments" accounts aren't null. (Unless I misunderstood something?)

Attached is a minimum test ledger file that replicates the issue.
-- 
john2x.com | @john2x

You received this message because you are subscribed to a topic in the Google Groups "Ledger" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ledger-cli/2pDVWHUEVNc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ledger-cli+...@googlegroups.com.
test.ledger

Daniël Bos (远洋)

unread,
Nov 25, 2014, 9:09:11 PM11/25/14
to ledge...@googlegroups.com
I don't have access to ledger at the moment, but have you tried putting in the entries in chronological order?

Craig Earls

unread,
Nov 25, 2014, 11:07:23 PM11/25/14
to ledge...@googlegroups.com
I confirm that your file demonstrates the error.  But, you must remember that ledger files are order dependent.  The first xact in this example sets the account to a null values (0 is the same as null in ledger) If you move the reset transaction to the end this goes away.

I am on the fence whether or not to call this a bug.  Having the very first transaction in a file set the account balance to zero seems pointless.  But, I don't see a reason why it should not be allowed.  John will have to weigh in on the overall effect of changing this.

Martin Blais

unread,
Nov 25, 2014, 11:22:26 PM11/25/14
to ledger-cli
For some background on this, this might be useful, a summary of discussions that explain the distinction between file assertions (in Ledger) and dated balance assertions (in Beancount):


John Louis Del Rosario

unread,
Nov 27, 2014, 3:27:49 AM11/27/14
to ledge...@googlegroups.com
Thanks. Yes, ordering the transactions makes it legal. Unfortunately I organize my ledger file with newest transactions at the top.
I'll make do for now :)

But would a feature request for a flag or option to specify the transaction date order make sense?

Craig Earls

unread,
Nov 27, 2014, 11:57:44 AM11/27/14
to ledge...@googlegroups.com
You can always request, but the date ordered file is pretty deeply ingrained.

--

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

Martin Blais

unread,
Nov 27, 2014, 12:25:55 PM11/27/14
to ledger-cli
If you really care about this particular aspect of it:



--

John Wiegley

unread,
Nov 29, 2014, 8:09:35 PM11/29/14
to ledge...@googlegroups.com
>>>>> Craig Earls <ende...@gmail.com> writes:

> I confirm that your file demonstrates the error. But, you must remember that
> ledger files are order dependent. The first xact in this example sets the
> account to a null values (0 is the same as null in ledger) If you move the
> reset transaction to the end this goes away.

> I am on the fence whether or not to call this a bug. Having the very first
> transaction in a file set the account balance to zero seems pointless. But,
> I don't see a reason why it should not be allowed. John will have to weigh
> in on the overall effect of changing this.

Just to be 100% sure, but in these examples where a balance assignment is
being made, there are at least two spaces after the account name, yes?

John

Craig Earls

unread,
Nov 29, 2014, 8:11:24 PM11/29/14
to ledge...@googlegroups.com
Yes. This user is putting xacts in his file most recent first. It is the order that is rely causing the error. But the error message could be more helpful. 
--

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

Adrian Whitfield

unread,
May 20, 2016, 1:04:32 PM5/20/16
to Ledger
Hi can I bump this topic please?

The error seems to be deeper than the OP's example case.  Consider my attached file.

The error occurs when the *difference* between the actual and the reset balance is zero.  In the attached file the resetting transaction is equal to the actual balance at that point (-300 P).  

This presents a problem for my use case.  I am trading currencies and my ledger file is built automatically.  I was hoping to end the file with the current broker balances of these currencies and adjusting any differences into broker fees, which aren't reported in my transactions currently.

Can someone please revisit this and perhaps report it as a bug (unless there's a good work around that is).  Bugzilla isn't allowing me to login or register for some reason.

Thanks, 

Adrian

test.ledger

Jostein Berntsen

unread,
May 21, 2016, 5:12:34 AM5/21/16
to Ledger

Adrian Whitfield

unread,
May 23, 2016, 4:45:18 AM5/23/16
to Ledger
I'm sure of it Jostein, but I'm unable to register it on ledger's Bugzilla page  frustratingly.

Perhaps you or someone else could try to so it gets addressed?

John Wiegley

unread,
May 23, 2016, 1:35:24 PM5/23/16
to Adrian Whitfield, Ledger
>>>>> Adrian Whitfield <whitfiel...@gmail.com> writes:

> I'm sure of it Jostein, but I'm unable to register it on ledger's Bugzilla
> page <http://bugs.ledger-cli.org/> frustratingly.

What happens?

--
John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2

Adrian Whitfield

unread,
May 23, 2016, 7:54:16 PM5/23/16
to Ledger, whitfiel...@gmail.com, jo...@newartisans.com
Sorry - invite link ended up in spam!  Schoolboy error!

Should I go ahead and raise it as a bug?

John Wiegley

unread,
May 23, 2016, 11:49:38 PM5/23/16
to Adrian Whitfield, Ledger
>>>>> Adrian Whitfield <whitfiel...@gmail.com> writes:

> Should I go ahead and raise it as a bug?

Please do. :)

Adrian Whitfield

unread,
May 26, 2016, 11:17:43 AM5/26/16
to Ledger, whitfiel...@gmail.com, jo...@newartisans.com
Okay, have done.

Reply all
Reply to author
Forward
0 new messages