Selecting and Sorting Transactions

Mike Bray (Quote Loader Author)'s Avatar

Mike Bray (Quote Loader Author)

31 May, 2015 07:20 AM

Hi

I have an extension that displays transactions. I only want a subset of them (by date and account) but I want both sides of the transaction. I can search through the transaction set for the file but as time goes by the number of transactions will increase and thus the time to extract the transactions you want will increase. Is there a mechanism that retrieves a subset of transactions that does not involve reading through every transaction?

Once I have the transactions I wish them to be in the sequence they were entered. What fields within a transaction can be used to do the sorting?

Regards
Mike

  1. Support Staff 1 Posted by Sean Reilly on 03 Jun, 2015 03:25 PM

    Sean Reilly's Avatar

    Hi Mike,

    There are built-in methods for selecting a subset of transactions such as TransactionSet.getTransactions(TxnSearch) as well as a couple of static methods in TxnUtil for getting a search object for an account and/or date range. That is probably the fastest method although that doesn't use indexes and still just iterates over the set of transactions, so you'll want to make any searches pretty efficient.

    You can sort by the static AccountUtil.sortTransactions(TxnSet, int sortField) method. The fields are defined as static ints in the AccountUtil class. With more recent builds you can use the *_COMPARATOR static comparators in the TxnUtil class.

    Thanks!
    Sean

  2. 2 Posted by Mike Bray (Quot... on 03 Jun, 2015 06:54 PM

    Mike Bray (Quote Loader Author)'s Avatar

    Thanks Sean, I am still using 1204 so I will upgrade when you put out 2015.4. I will then look at the Comparator.

    Regards
    Mike

  3. Ethan closed this discussion on 04 Jun, 2015 12:57 PM.

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

Recent Discussions

28 Apr, 2025 08:12 AM
28 Apr, 2025 02:37 AM
27 Apr, 2025 10:33 PM
27 Apr, 2025 07:00 PM
27 Apr, 2025 06:58 PM