Python - how to register a change to a transaction

cbollig's Avatar


26 May, 2020 02:51 AM

I'm just learning to code in Moneydance and Python, so I could use some guidance.

I 'm using MoneyBot Console and have modified the transaction check # column to the check number that the bank puts in the description field. But the check # column data goes away unless I manually save the transaction changes. How are the transaction changes done in Python?
Here the code so far:

## This script changes all transactions with the given payee
## to have the specified account/category

from com.infinitekind.moneydance.model import *

import sys
import time
from com.infinitekind.moneydance.model import AccountUtil

book = moneydance.getCurrentAccountBook()
for acct in AccountUtil.getAccountIterator(book):
# print acct.getFullAccountName()

## Change the account/category name below to the one that should
## be given to the transactions with the above payee
 acct = book.getRootAccount().getAccountByName("Main_Checking - Hists_s03.qif")

## Change the payee (case insensitive) in the next line
payee = "Paid Check".upper()
if payee:
  for txn in book.getTransactionSet().iterator():
# print txn.getDescription().upper()
    allpayee = txn.getDescription().upper()
    if "PAID CHECK" in allpayee:
     print "Paid Check in payee '%s'" %(allpayee)
     checknum = allpayee.partition("-")
     print "checknum '%s'"%(checknum[2])

Thanks, Charlie

  1. cbollig closed this discussion on 29 May, 2020 02:04 AM.

  2. cbollig re-opened this discussion on 29 May, 2020 02:05 AM

  3. 1 Posted by cbollig on 29 May, 2020 02:07 AM

    cbollig's Avatar

    never mind. I added the following two lines at the bottom within the iterator :
    Those two statements didn't do it correctly.
    Replace those two with this one:

  4. cbollig closed this discussion on 29 May, 2020 02:07 AM.

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

Keyboard shortcuts


? 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