Re: Automated transaction amounts "doubled"

2022-11-10 Thread Robert Shanley
Thanks, John. That clarification really helps.

On Thu, Nov 10, 2022 at 10:30 AM John Wiegley  wrote:

> > "RS" == Robert Shanley  writes:
>
> RS> journal.txt:
> RS> = expr payee == "Joe"
> RS> SetAside$100
> RS> MoreMoney  -$100
>
> RS> 2022/01/05 * Joe
> RS> Stuff $600.00
> RS> Checking
>
> RS> ledger -f journal.txt balance :
>
> RS> $-600.00  Checking
> RS> $-200.00  MoreMoney
> RS>  $200.00  SetAside
> RS>  $600.00  Stuff
>
> RS> What am I doing wrong?
>
> Your automated transaction expression is matching each posting within your
> transaction, since they both have a payee of Joe. Imagine your file had
> looked
> like this:
>
> 2022/01/05 * Joe
> Stuff $600.00
>
> 2022/01/05 * Joe
> Checking
>
> That's where the doubling is coming from.
>
> John
>

-- 

--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/CAPmauXPtisSyqAvSXhnOzYQ%3DoA3MAAQPHpNVL8Z0G2DCwAx-6Q%40mail.gmail.com.


Re: Automated transaction amounts "doubled"

2022-11-10 Thread John Wiegley
> "RS" == Robert Shanley  writes:

RS> journal.txt:
RS> = expr payee == "Joe"
RS> SetAside$100
RS> MoreMoney  -$100

RS> 2022/01/05 * Joe
RS> Stuff $600.00
RS> Checking

RS> ledger -f journal.txt balance :

RS> $-600.00  Checking
RS> $-200.00  MoreMoney
RS>  $200.00  SetAside
RS>  $600.00  Stuff

RS> What am I doing wrong?

Your automated transaction expression is matching each posting within your
transaction, since they both have a payee of Joe. Imagine your file had looked
like this:

2022/01/05 * Joe
Stuff $600.00

2022/01/05 * Joe
Checking

That's where the doubling is coming from.

John

-- 

--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/m2bkpe1zvg.fsf%40newartisans.com.


Re: Automated transaction amounts "doubled"

2022-11-08 Thread Robert Shanley
Thanks, that seems to have worked.

On Tuesday, November 8, 2022 at 8:47:15 PM UTC-7 Martin Michlmayr wrote:

> * Robert Shanley  [2022-11-08 17:51]:
> > = expr payee == "Joe"
> > SetAside $100
> > MoreMoney -$100
> > 
> > 2022/01/05 * Joe
> > Stuff $600.00
> > Checking
> > 
> > What am I doing wrong?
>
> My guess is that it's evaluated for each posting, so once for Stuff
> and once for Checking. Therefore $200
>
> You could do something like:
>
> = /Stuff/ and expr payee == "Joe"
> SetAside $100
> MoreMoney -$100
>
> -- 
> Martin Michlmayr
> https://www.cyrius.com/
>

-- 

--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/c1552310-e66f-4168-9aaf-5a742e0a8848n%40googlegroups.com.


Automated transaction amounts "doubled"

2022-11-08 Thread Robert Shanley
journal.txt:

= expr payee == "Joe"
SetAside$100
MoreMoney  -$100

2022/01/05 * Joe
Stuff $600.00
Checking

ledger -f journal.txt balance :

$-600.00  Checking 
$-200.00  MoreMoney 
 $200.00  SetAside 
 $600.00  Stuff

What am I doing wrong?
Thanks.  

   0

-- 

--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/b1929ffe-3439-4a58-b0ae-8d1e9400ff92n%40googlegroups.com.