How do you add tags to a transaction

Bob B's Avatar

Bob B

25 May, 2020 07:15 PM

I'm trying to find documentation on how tags are added to the parent and split transaction types. I'm using makeParentTxn and makeSplitTxn. I found reference to legacy tags but that sounds like it is an old way of doing things. Can anyone point me in the right direction. Thanks

  1. Support Staff 1 Posted by Sean Reilly on 25 May, 2020 07:43 PM

    Sean Reilly's Avatar

    Hi Bob,

    I think the method you want is setKeywords(List), which is tricky to find because it's in the superclass of the transaction classes:
    https://infinitekind.com/dev/apidoc/com/infinitekind/moneydance/mod...

    Thanks!
    Sean

    --
    Sean Reilly
    Developer, The Infinite Kind
    https://infinitekind.com

  2. 2 Posted by Bob B on 28 May, 2020 01:30 AM

    Bob B's Avatar

    ThanksI've got it now.

  3. 3 Posted by Max Pixel on 11 Jun, 2020 06:14 AM

    Max Pixel's Avatar

    I had tried adding a keyword by using getKeywords().add(...), but ended up with the tag repeated numerous times. Given that I was creating transactions inside of a loop, I suspect this is because calling getKeywords() on a newly created transaction returns some sort of recycled List instance. Calling setKeywords with a new list works, but the behavior I encountered indicates to me that something under the hood is implemented in an undesirably risky way.

  4. Support Staff 4 Posted by Sean Reilly on 11 Jun, 2020 09:18 AM

    Sean Reilly's Avatar

    Yes, that getKeywords method should be returning an immutable list. Thanks, I'll sort that out!

    --
    Sean Reilly
    Developer, The Infinite Kind
    https://infinitekind.com

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac