How do I construct a filter for ’TxnSet getTransactions(TxnSearch filter)’?
’TxnSet getTransactions(TxnSearch filter)’. There’s zero documentation for this. How do I construct a TxnSearch filter? I’m trying to avoid using book..getTransactionSet().getAllTxns() and limit this to certain Account Types. (Yes I know I can filter these out by iterating through them, but seems inefficient). I'm using Python, but happy to decode Java.... Thanks for any pointers?
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 27 Sep, 2020 01:05 PM
Hi Stuart,
The idea with TxnSearch is that it is an interface that is implemented by specific searches, ... or filters really, as they work the same way as AcctFilter. It might be tricky to implement java interfaces on the python side, but I think you can do something like:
There are a few classes that implement TxnSearch which you are welcome to use. They weren't previously in the API docs for some reason, but they've been around forever. I've just updated the api docs on the web site and they appear there now. One of them is GenericTxnSearch which lets you search for specific fields or AggregateTxnSearch which makes it easier to combine multiple criteria (possibly multiple GenericTxnSearch instances).
Hope this helps!
Sean
--
Sean Reilly
Developer, The Infinite Kind
https://infinitekind.com
2 Posted by Stuart Beesley ... on 27 Sep, 2020 01:13 PM
Thanks. I’ll have a play with your example class below… Regarding GenericTxnSearch() etc - thanks, but I may be missing the obvious but I cannot think how to use them…. Sorry for the followup question, but can you provide an example of how to use this? Once I can see that I will understand how to do it differently.
Can you see my other support question regarding the Account Filter too - Thanks
3 Posted by Stuart Beesley ... on 27 Sep, 2020 06:45 PM
Thanks. You've told me that: 'you can use it on the TransactionSet object, so accountBook.getTransactionSet().getTransactions(TxnSearch).'
This works with my self constructed class - as you said above.....
Stuart Beesley (Mr Toolbox) closed this discussion on 27 Sep, 2020 06:46 PM.