API .getPreferredSortOrder() etc does not seem to work?

I'm trying to return the user selected sort order for the GUI txn register display.
I am iterating the accounts and calling account
.getPreferredSortAscending​(boolean defaultVal)
.getPreferredSortOrder​(int defaultOrder)
.getPreferredTwoLines​(boolean defaultVal)

The methods force you call with a default value, but all that ever comes back is the value I called it with.

The config.dict file holds:
"col_widths.bank","Bank", etc with sort=x data, but this seems only loosely linked and I seem to be able to set my sort by account on the GUI, rather than all.

So what's going on? How do I get the GUI sort set by account?


getPreferredSortAscending​(boolean defaultVal)
getPreferredSortOrder​(int defaultOrder)
getPreferredTwoLines​(boolean defaultVal)

  1. 1 Posted by Stuart Beesley ... on 17 Nov, 2020 10:16 AM

    Stuart Beesley - JUST A FELLOW USER's Avatar


  2. 2 Posted by Stuart Beesley ... on 24 Nov, 2020 07:06 AM

    Stuart Beesley - JUST A FELLOW USER's Avatar

    Sean has replied:

    You're on the right track! The UI preferences for an individual account are stored in a string which is an encoded com.infinitekind.tiksync.SyncRecord object. As you discovered, the preferences key is col_widths.<registertype> where <registertype> is one of bank, cc, loan, invest, secdetail, or misc. To get the settings for a specific account you can call String prefString = account.getPreference(preferencesKey, null) . If the return value is null or an empty string then you can call prefs.getSetting(preferencesKey, null) where prefs is an instance of the moneydance app UserPreferences object, which I'm guessing you've probably already found. The resulting string value, if any, will be an encoded SyncRecord object which you can get by calling SyncRecord params = new SyncRecord(); params.readSet(new StringReader(prefString)) at that point you have the UI preferences for the account (or for the type of register, as a fallback) in the SyncRecord which is a handy way to access the multiple details. For the sort order and ascending/descending status you can use:
    boolean ascending = params.getBoolean("ascending", true); TxnSortOrder sortID = TxnSortOrder.fromInt(params.getInt("sort", -1), ascending) TxnSortOrder is a public enum in the com.infinitekind.moneydance.model package and has all of the currently supported sort orders.

  3. Stuart Beesley - JUST A FELLOW USER closed this discussion on 24 Nov, 2020 07:06 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? 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

18 Jan, 2021 12:26 AM
17 Jan, 2021 11:08 PM
17 Jan, 2021 11:08 PM
17 Jan, 2021 10:49 PM
17 Jan, 2021 09:58 PM