TransactionSet.getTransactions(TxnSearch)
Excuse me if this is obvious....
I saw a comment in the discussions: There are built-in methods for selecting a subset of transactions such as TransactionSet.getTransactions(TxnSearch).
However, I can see no guidance on how to properly construct the TxnSearch argument.
Could someone please give a detailed example, say the Transactions to be searched is txnset and I want to search for txns DateInt() == 20191231; I would have thought that q = txnset.getTransactions(txnset.getDateInt() == 20191231)
would work.
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
1 Posted by hleofxquotes on 19 Apr, 2019 03:49 PM
TxnSearch is an interface. To search for date, you probably need to use TxnDateSearch which implements TxnSearch.
In Java,
2 Posted by davidcullen on 20 Apr, 2019 06:09 AM
Thanks, but I am not fully comfortable with java. I'm using jython. I solved the problem using
but wondered if there was a better way.davidcullen closed this discussion on 29 Apr, 2019 12:27 AM.
Sean Reilly re-opened this discussion on 29 Apr, 2019 08:19 AM
Support Staff 3 Posted by Sean Reilly on 29 Apr, 2019 08:19 AM
Hi David,
If I understand correctly you could do something like this in python:
Thanks,
Sean
--
Sean Reilly
Developer, The Infinite Kind
https://infinitekind.com
4 Posted by davidcullen on 29 Apr, 2019 08:36 AM
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.
I am currently getting tens using filter:
txns = filter(lambda x:x.x.__class__.__name__ ) == “SplitTxn” and x.getKeywords().size() > 1, txnset)
but wondered if there was a better way.
Kind regards,)
David Cullen
[email blocked]
44 Bell Street
Rockingham WA 6168
Home: 089 527 1815
Support Staff 5 Posted by Sean Reilly on 29 Apr, 2019 10:03 AM
Hi David,
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.
Thanks,
Sean
6 Posted by davidcullen on 29 Apr, 2019 02:32 PM
Thanks. Your answer makes sense. I will keep using Filter.
davidcullen closed this discussion on 29 Apr, 2019 02:32 PM.