Discussion:
Checking for Tag Value in Automated Transaction
Brandon Olivares
2018-07-27 05:56:08 UTC
Permalink
Hello,

I have an automated transaction where I'm wanting to split up income into different envelope categories when received, based on the value of a tag set on income transactions.

Here's what I tried:

= /^Budget:Available:Income/ and tag BudgetType=Debt

And it works as long as BudgetType is set, but it doesn't care what the value is. If I set BudgetType=Foo, it still works.

How can I test the tag value?

Thanks,
Brandon
--
---
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.
Scott Carpenter
2018-07-27 11:29:54 UTC
Permalink
I don't know if this should be any different, but I always query on tags
with the % symbol, e.g.

%BudgetType=Foo
Post by Brandon Olivares
Hello,
I have an automated transaction where I'm wanting to split up income into
different envelope categories when received, based on the value of a tag
set on income transactions.
= /^Budget:Available:Income/ and tag BudgetType=Debt
And it works as long as BudgetType is set, but it doesn't care what the
value is. If I set BudgetType=Foo, it still works.
How can I test the tag value?
Thanks,
Brandon
--
---
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.
Brandon Olivares
2018-07-27 13:33:17 UTC
Permalink
Thanks, what ended up working was:

= expr 'tag("BudgetType") =~ /^Debt$/'

But one more question: is it possible to use the tag value in a posting of an automated transaction, like for calculating how much goes into a particular account?

I want to have a tax transaction to send a percentage into a liabilities account, but want to have that percentage customizable. Right now my transaction looks like this:

= tag Taxable
Expenses:Tax:2018:Estimated 0.2
Liabilities:Tax:2018:Estimated -0.2

I'd like to be able to change that 0.2 by a tag like TaxRate. Is this possible?
I don't know if this should be any different, but I always query on tags with the % symbol, e.g.
%BudgetType=Foo
Hello,
I have an automated transaction where I'm wanting to split up income into different envelope categories when received, based on the value of a tag set on income transactions.
= /^Budget:Available:Income/ and tag BudgetType=Debt
And it works as long as BudgetType is set, but it doesn't care what the value is. If I set BudgetType=Foo, it still works.
How can I test the tag value?
Thanks,
Brandon
--
---
You received this message because you are subscribed to the Google Groups "Ledger" group.
For more options, visit https://groups.google.com/d/optout <https://groups.google.com/d/optout>.
--
---
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.
Continue reading on narkive:
Loading...