[GNC] Order of transactions

Derek Atkins derek at ihtfp.com
Fri Mar 8 14:55:44 EST 2019


Adrien,

On Fri, March 8, 2019 2:41 pm, Adrien Monteleone wrote:
> I didn’t mean to still be able to sort by the real transaction number, but
> if you have one, and you’ve repurposed the NUM field, you’ll likely want a
> place to put it just for reference. I simply offered an overview of the
> remaining options. Overloading NUM as a time field is pretty much giving
> up on using it to hold a real transaction number. (though one user piped
> in they used a yyyy.nnnn format that seems to work, though I don’t see how
> with the intervening “.”)

As I said, the string field is converted to an integer using the
C-language atoi() function and then the sort happens using the numerical
value.  So the string yyyy.nnnn with be converted into the number yyyy and
that will be used to sort.  If yyyy is 0001, this would be sorted before a
yyyy of 2.  Basically, the conversion for sorting will stop at the first
non-numeral character.  That's why using yyyy.nnnn works.  Or yyyy-nnnn. 
Even yyyyAnnnn will work (this is all assuming the yyyy and nnnn are all
numerals).

So 00011.16298462 will come before 2.294362.   If it were a pure string
compare, then this would not be the case.

> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.

-derek

-- 
       Derek Atkins                 617-623-3745
       derek at ihtfp.com             www.ihtfp.com
       Computer and Internet Security Consultant



More information about the gnucash-user mailing list