How do you add tags to a transaction

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. 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. ThanksI've got it now.

  3. 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. 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

  5. System closed this discussion on 10 Sep, 2020 09:20 AM.

Comments are currently closed for this discussion. You can start a new one.

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