Creating Transactions
When creating transaction I see that the Old ID is still being set on some transactions. The ones I have generated have -1 in the old ID. How is this set? Where does the next number come from? Can I depend on it for sorting?
Regards
Mike
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 02 Jun, 2015 02:52 PM
The old IDs are deprecated and shouldn't be used anymore. However, if you'd like to make sure that something is there you can do something like passing System.currentTimeMillis() to get something that *should* be unique but not necessarily.
The problem with the old IDs is that they can't ever be guaranteed unique now that syncing is a built-in function.
Thanks,
Sean
2 Posted by Mike Bray (Quot... on 03 Jun, 2015 06:18 AM
Thanks Sean
I would need all transactions to have a unique number so I will drop it.
What is the best way to sort transactions so they are in entered sequence?
Regards
Mike
Support Staff 3 Posted by Sean Reilly on 03 Jun, 2015 03:29 PM
I would recommend using the TxnUtil.DATE_ENTERED_COMPARATOR to sort the transactions. That can be used in java collections or in the TxnSet.sortWithComparator(...) method, but only in relatively recent builds. I think that API is clean enough that it's worth bumping the requirements to a recent build.
Also, FYI, I'm going to be pushing the current preview of MD2015.4 out as a stable release either today or tomorrow (hopefully), so targeting that build number will probably get a good number of users pretty quickly.
Thanks!
Sean Reilly
Developer, The Infinite Kind
http://infinitekind.com
Mike Bray (Quote Loader Author) closed this discussion on 06 Jun, 2015 04:02 AM.