Updating a Python script; method defs seem to have chabged
I am attaching a script I wrote to export selected transactions to a .csv file for generating a spreadsheet. The code loops through all accounts and takes each in turn. When attempting to run this script with Moneydance version 2015.6 build 1299, I got an error message that the method getHighestAccountNum() no longer exists. The existing code sequence is as follows:
. . .
ra = moneydance.getRootAccount()
. . .
accts = []
for i in range(0, ra.getHighestAccountNum()):
acct = ra.getAccountById(i+1) # loop thru acct nums
if acct == None: # not all are valid
continue
. . .
accts.append(i+1) # build list of acct id's
for id in accts:
acct = ra.getAccountById(id)
acct_name = acct.getAccountName()
. . .
I have looked through the current API and it appears that the "account number" is no longer valid. What is the current recommended approach to get a list of all accounts and loop through them? Thanks in advance for any useful help.
David Friedman
[email blocked]
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 Mar 01, 2016 @ 09:28 PM
Hi David,
Yes, we've cleaned up quite a bit for Moneydance 2015, but to be honest, using getHighestAccountNum() isn't the most efficient way of doing it. I'll chalk this up to our documentation being bad :)
The best way in Moneydance 2015 is using something like this:
Thanks!
Sean Reilly
Developer, The Infinite Kind
http://infinitekind.com
Sean Reilly closed this discussion on Mar 01, 2016 @ 09:28 PM.