tag:infinitekind.tenderapp.com,2009-01-14:/discussions/moneydance-development/1707-python-help-switch-memo-and-descriptionInfinite Kind: Discussion 2017-02-16T00:30:24Ztag:infinitekind.tenderapp.com,2009-01-14:Comment/412366612016-11-16T07:05:57Z2016-11-16T07:05:59ZPython help - switch memo and description<div><p>Edit:<br>
Here's what I have so far. It gets memo and description info fine,
and ignores splits and transactions with no memo.</p>
<p>But trying to actually edit the transaction yields nothing. The
transactions stay as they were. What am I missing?</p>
<p>#!/usr/bin/env python</p>
<h1>
<a name="python-script-to-be-run-in-moneydance-to-perform-amazing-feats-of-financial-scripting" class="anchor" href="#python-script-to-be-run-in-moneydance-to-perform-amazing-feats-of-financial-scripting">
</a>Python script to be run in Moneydance to perform amazing feats
of financial scripting</h1>
<p>from com.infinitekind.moneydance.model import *</p>
<p>import sys<br>
import time</p>
<h1>
<a name="get-the-default-environment-variables-set-by-moneydance" class="anchor" href="#get-the-default-environment-variables-set-by-moneydance"></a>get
the default environment variables, set by Moneydance</h1>
<p>print "The Moneydance app controller: %s"%(moneydance)<br>
print "The current data set: %s"%(moneydance_data)<br>
print "The UI: %s"%(moneydance_ui)</p>
<p>if moneydance_data:<br>
txnSet = moneydance_data.getTransactionSet()</p>
<pre>
<code>counter = 0
for txn in txnSet.iterableTxns():
try:
txn.getOtherTxn(1)
continue # it's a split transaction. ignore and loop again
except:
pass # it's not a split transaction. let's keep going
desc = txn.getDescription()
memo = txn.getMemo()
print desc
print memo
if memo != '':
txn.setDescription(memo)
txn.setMemo(desc)</code>
</pre></div>Paultag:infinitekind.tenderapp.com,2009-01-14:Comment/412366612016-11-16T15:52:49Z2016-11-16T15:52:50ZPython help - switch memo and description<div><p>Have you tried calling .syncItem() on your txn after changing
it?</p></div>viranthatag:infinitekind.tenderapp.com,2009-01-14:Comment/412366612016-11-17T00:22:28Z2016-11-17T00:22:28ZPython help - switch memo and description<div><p>Thank you!</p></div>Paul Wirth