NameError: global name 'getParentTxn' is not defined
I'm not sure if I am doing something incorrectly? I'm now using md 3017.7 (16680 on my mac.
The docs suggest that getParentTxn is a function but I get "NameError: global name 'getParentTxn' is not defined" as an error message.
Here is my code:
from com.infinitekind.moneydance.model import *
import java.util.ArrayList
import sys
book = moneydance.getCurrentAccountBook()
txnset = book.getTransactionSet()
#get all Accounts with Comment which includes 'RentalPropertyAgent'
rentalPropertyAgentAccounts = filter(lambda x:'RentalPropertyAgent' in x.comment, AccountUtil.getAccountIterator(book))
for account in rentalPropertyAgentAccounts:
for txn in txnset.getTransactionsForAccount(account):
for i in range(getParentTxn(txn).getOtherTxnCount()):
if isinstance(getParentTxn(txn).getSplit(i), ParentTxn):
print "p"
else:
print "s"
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
Support Staff 1 Posted by Sean Reilly on 15 Mar, 2018 11:43 AM
Hi David,
I think the issue is that getParentTxn() is an instance method, so you should be calling txn.getParentTxn(). Also instead of using isinstance() you could use txn.getParentTxn()==txn
Thanks,
Sean
System closed this discussion on 14 Jun, 2018 11:50 AM.