Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Secondary 'Sort By' Column #4690

Closed
vomikan opened this issue Jun 21, 2022 · 16 comments
Closed

Secondary 'Sort By' Column #4690

vomikan opened this issue Jun 21, 2022 · 16 comments
Assignees
Milestone

Comments

@vomikan
Copy link
Member

vomikan commented Jun 21, 2022

https://forum.moneymanagerex.org/viewtopic.php?t=10552

When sorting by transactions by 'Payee' in Account View, transactions are sorted by 'Payee', then seemingly by ID as a secondary value. It would be great if we could select the secondary sorting to be via Date (or any other value desired).

The issue with the current solution is that when future transactions are entered for the same payee, but then you add additional transactions in a shorter timeframe, there is no way to have them sort in ascending date ordered by AND payee, without deleting/recreating them in the desired order, to get ascending IDs.

@whalley
Copy link
Member

whalley commented Jun 21, 2022

How about having the secondary sort set to the last sort column.
E.g.

  1. sort by Date
  2. sort by Payee (secondary sort is now Date)
  3. sort by ID (secondary sort is now Payee)
  4. sort by Payee (secondary sort is now by ID)

Just a thought. Avoids any UI changes,

@tactilis
Copy link

How about having the secondary sort set to the last sort column.

I have sometimes wished for this myself but I can see good and less good consequences of this.

  1. At present, if you enter transactions manually as you actually make them or, more likely, import the transactions from a bank account, then simply clicking on the Date column to sort by Date>ID will always match the order of transactions as entered (i.e. same order as on your bank statement).

    If we implement 'last sort column becomes the secondary sort', then simply clicking on the Date column will not necessarily give the same order as in the bank. We are likely to get more people asking questions such as "Why doesn't the MMEX balance match my bank balance", or "Why can't MMEX add up the balances correctly", which we have often seen on the forum.

  2. Because of the above, does it make sense to show visually which column is being used as the secondary sort?

  3. In the case of click to sort by Date, then click to sort by Payee (for example), should the secondary sort by Date remember the order (ascending / descending) that the user had set before clicking on Payee? If so, and we provide a visual indicator of the secondary sort column, then should this show whether the sort is ascending / descending?

  4. Following on from 3, if the user clicks on Payee again, should this just reverse the Payee order but leave the secondary date order as it was?

  5. At present, the user selected sort column and direction of sort is saved (in mmexini.db3 I presume) so that this is remembered for the next MMEX run. If this change is implemented, then we should also remember the user-selected secondary sort order.

Avoids any UI changes

Maybe.
To be debated.

@whalley
Copy link
Member

whalley commented Jun 21, 2022

All good points... Maybe we enforce that sort by Date always has ID as secondary and sort by ID has no secondary sort (ID will be unique anyway)?

...more debate to be had.

@vomikan
Copy link
Member Author

vomikan commented Jun 21, 2022

  1. We can refuse to reverse (We can set it globally). Or do a reverse with the (Shift) key pressed
  2. We can do secondary sorting with the keyboard key pressed (Ctrl).

It is possible to display the sorting attribute on two columns at the same time. The only thing that is needed is for the primary and secondary sorting icon to differ.
image

The algorithm can be like this. One click reverses, the second click removes the sorting feature, the third click sets the sorting again.
In this case, you can sort by an unlimited number of columns.

@tactilis
Copy link

The only thing that is needed is for the primary and secondary sorting icon to differ.

For example:

image

Would that work for all the themes?

@whalley
Copy link
Member

whalley commented Jun 21, 2022

Oooo... it is getting complicated. :-)

@tactilis
Copy link

@vomikan

In this case, you can sort by an unlimited number of columns.

I think that two columns (primary and a secondary) would be sufficient for 99% of people who want to sort their transactions. And with any more, it gets difficult to show the sorting order visually.

And I would assert that it's only a fraction of users that need to sort at all; i.e. most people are happy with the standard Date > ID sort because that matches their bank statement.

In the forum, we've even encountered people who are unaware that clicking on a column header is a standard way of sorting tabular data in (most) apps.

@vomikan
Copy link
Member Author

vomikan commented Jun 21, 2022

And with any more, it gets difficult to show the sorting order visually.

You are right.

@BanCrash
Copy link
Contributor

BanCrash commented Jun 24, 2022

Calibre for example uses the method that @whalley said on second comment and for me it's very useful. Never needed another more.

Searching on internet I've found someone that said that Calibre uses the last 3 columns used to sort instead only the 2 like on that example, but IMO only the last 2 (the previous and the actual) would be enough.

@vomikan vomikan added this to the v1.5.21 milestone Sep 2, 2022
@whalley whalley assigned whalley and unassigned whalley Sep 6, 2022
whalley pushed a commit to whalley/moneymanagerex that referenced this issue Sep 8, 2022
@whalley
Copy link
Member

whalley commented Sep 8, 2022

Should now be able to sort data by multiple columns. I've not put a secondary sort marker on the view as I feel this may confuse casual users who just normally sort by ID or DATE. It should save/restore the secondary and primary sort order.

@whalley whalley added the fixed label Sep 8, 2022
vomikan added a commit that referenced this issue Sep 8, 2022
@tactilis
Copy link

tactilis commented Sep 8, 2022

Testing 1.5.21-Beta.1 commit: dac3e54 (2022-09-08)

I've checked the primary/secondary sort for several combinations of columns in Bank transactions. All seems OK.

Does this enhancement apply to Assets yet?

While trying to check this, I noticed that the Ascending/Descending sort marker for assets Dates is the wrong way round.

image

UPDATE: The wrong sort marker is used for all asset columns.

@whalley
Copy link
Member

whalley commented Sep 8, 2022

Does this enhancement apply to Assets yet?

No, I've only implemented it for the transactions view. Other views only support single column sorting.

UPDATE: The wrong sort marker is used for all asset columns.

Can you raise an issue for that and we will look to fix.

@whalley
Copy link
Member

whalley commented Sep 8, 2022

I've checked the primary/secondary sort for several combinations of columns in Bank transactions. All seems OK.

I think it should support multiple levels of sorting, not just two - though I think the benefits of greater that two are not too valuable. It's only that we save/recover the primary and secondary.

@tactilis
Copy link

tactilis commented Sep 8, 2022

I think the benefits of greater that two are not too valuable. It's only that we save/recover the primary and secondary.

Agreed and Noted.

@rusty6285
Copy link

rusty6285 commented Sep 21, 2022

thank you for implenting! It appears to be working as intended in the version just deployed, but I dont see where to change the secondary sort field? (using portable build - I had expected to find it in the options panel)

@whalley
Copy link
Member

whalley commented Sep 21, 2022

As noted above....

The secondary sort is set to the last sorted column, we don't need any special settings.
E.g.

  • sort by Date
  • sort by Payee (secondary sort is now Date)
  • sort by ID (secondary sort is now Payee)
  • sort by Payee (secondary sort is now by ID)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants