tag:infinitekind.tenderapp.com,2009-01-14:/discussions/moneydance-development/2396-transactionsetgettransactionstxnsearchInfinite Kind: Discussion 2019-04-29T14:32:38Ztag:infinitekind.tenderapp.com,2009-01-14:Comment/471900962019-04-19T15:49:02Z2019-04-19T15:49:02ZTransactionSet.getTransactions(TxnSearch) <div><p>TxnSearch is an interface. To search for date, you probably need to use TxnDateSearch which implements TxnSearch.</p>
<p>In Java,</p>
<pre>
<code> TransactionSet transactionSet = book.getTransactionSet();
int date = 20191231;
TxnSearch txnSearch = new TxnDateSearch(date);
TxnSet transactions = transactionSet.getTransactions(txnSearch);</code>
</pre></div>hleofxquotestag:infinitekind.tenderapp.com,2009-01-14:Comment/471900962019-04-20T06:09:13Z2019-04-20T06:09:13ZTransactionSet.getTransactions(TxnSearch) <div><p>Thanks, but I am not fully comfortable with java. I'm using jython. I solved the problem using<br></p>
<pre>
<code> for row in readCSV:
found = filter(lambda x:x.<strong>class</strong>.<strong>name</strong> == "SplitTxn" and x.getDateInt() == int(row["DateInt"]) and str(x.getAccount()) == row["Account"] and str(x.getParentTxn().getAccount()) == row["ParentAccount"] and int(x.getValue()) == int(row["Value"]), txnset)</code>
</pre>
but wondered if there was a better way.</div>davidcullentag:infinitekind.tenderapp.com,2009-01-14:Comment/471900962019-04-29T08:19:04Z2019-04-29T08:19:04ZTransactionSet.getTransactions(TxnSearch) <div><p>Hi David,</p>
<p>If I understand correctly you could do something like this in python:</p>
<pre>
<code>found = txnset.getTransactions(TxnDateSearch(20191231))</code>
</pre>
<p>Thanks,<br>
Sean</p>
<p>--<br>
Sean Reilly<br>
Developer, The Infinite Kind<br>
<a href="https://infinitekind.com">https://infinitekind.com</a></p></div>Sean Reillytag:infinitekind.tenderapp.com,2009-01-14:Comment/471900962019-04-29T08:36:56Z2019-04-29T08:36:56ZTransactionSet.getTransactions(TxnSearch) <div><p>Thanks, Sean. This helps a little but what I was really trying to do was to get transactions which have specificitied other criteria instead of date. I am using python (I do not understand fully java.</p>
<p>I am currently getting tens using filter:</p>
<p>txns = filter(lambda x:x.x.<strong>class</strong>.<strong>name</strong> ) == “SplitTxn” and x.getKeywords().size() > 1, txnset)</p>
<p>but wondered if there was a better way.</p>
<p>Kind regards,)</p>
<p>David Cullen<br>
<a href="mailto:davidcullen@me.com">davidcullen@me.com</a></p>
<p>44 Bell Street<br>
Rockingham WA 6168<br>
Home: 089 527 1815</p></div>davidcullentag:infinitekind.tenderapp.com,2009-01-14:Comment/471900962019-04-29T10:03:15Z2019-04-29T10:03:15ZTransactionSet.getTransactions(TxnSearch) <div><p>Hi David,</p>
<p>Ah, I see now. Yes, if you'd like to filter for very specific things or want to do it in the most python-y way then you've got it. Moneydance has the built-in filter classes, but those don't include the keywords/tags filter and it's less elegant to make a python subclass of the TxnFilter java interface.</p>
<p>Thanks,<br>
Sean</p></div>Sean Reillytag:infinitekind.tenderapp.com,2009-01-14:Comment/471900962019-04-29T14:32:23Z2019-04-29T14:32:23ZTransactionSet.getTransactions(TxnSearch) <div><p>Thanks. Your answer makes sense. I will keep using Filter.</p></div>davidcullen