[GNC] Transaction ordering on num field

David Carlson david.carlson.417 at gmail.com
Tue Jun 8 17:20:16 EDT 2021

I would prefer 999a to sort before 1000a and character sorts to be case
insensitive, but I do not depend on that for any purpose.

I do, however, depend on the auto numbering function ignoring strings
containing non-numeric characters as it currently does, so it currently
only increments numbers and still numbers the next check correctly if I use
non-numeric characters in transactions that do not represent checks.

Those are my preferences!

On Tue, Jun 8, 2021 at 1:37 PM John Ralls <jralls at ceridwen.us> wrote:

> Really the effective num field because of the split-action option, but
> anyway...
> The submitter of PR#963 complained that sorting on the num field doesn't
> work right if the value is bigger than an int can hold; that's 9 digits.
> His knowledge of C wasn't quite up to the task of fixing it, but I've fixed
> his implementation and have it ready to push for GnuCash 4.6.
> So far so good, but it changes the order of transactions when the num
> field isn't all numeric and I want to know if the change will cause trouble
> for anyone.
> The current behavior is that a string beginning with a letter will have a
> sort value of 0 and one starting with a number will have a value equal to
> the numbers up to the first non-number character, so for example 12ab34
> will have a sort value of 12, up to ±(10^10 - 1). "abc" and "def" will sort
> equally so the compare would fall through to the next criterion; "abc"
> would sort between "-12ab34" and "12ab34".
> The new way is that if both strings are all numbers and there are fewer
> than 19 characters in each then the sort values will be their numeric
> values and the comparison will be numeric, so e.g. 2 sorts before 10. If
> those conditions aren't true then the two values will be string-compared,
> meaning a lexical sort: A very large number beginning with 2 will sort
> before a shorter number beginning with 3; "abc" will sort before "def" but
> after both "123" and "-123" because 1 and - sort before a. That's for an
> English locale; in order to accommodate UTF-8 strings the collation of the
> current locale.
> Will that break anyone's carefully-crafted transaction ordering?
> Regards,
> John Ralls
> _______________________________________________
> gnucash-user mailing list
> gnucash-user at gnucash.org
> To update your subscription preferences or to unsubscribe:
> https://lists.gnucash.org/mailman/listinfo/gnucash-user
> If you are using Nabble or Gmane, please see
> https://wiki.gnucash.org/wiki/Mailing_Lists for more information.
> -----
> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.

David Carlson

More information about the gnucash-user mailing list