Changing Extract Sort Order

54 views
Skip to first unread message

jfs...@gmail.com

unread,
Jan 8, 2017, 9:09:35 PM1/8/17
to Beancount
When a csv file is extracted, the transactions are printed out with the oldest date first and the newest date last.  I was wondering if there is a way to reverse the sort order, i.e. print out the newest date first and the oldest date last, as this is how I prefer to have them ordered in my file.  

I looked in the code, and I thought the sort order might be set in ingest/importers/data.py by the function sorted(entries).  It seems to call the Python function sorted().  Sorted(entries) seems to be a function, so it cannot be overridden, so I tried changing the code and adding a True to the functin call to reverse it as an experiment (I realize any change I make to the code is not the best way, and will break on an update).  It didn't work though, the date order was still the same, so either I did not interpret things correctly or missed something.

Is there an easy way to reverse the sort order?  Apoligies if it is something I should have seen in the documentation or the Google Groups.

Jonathan

Martin Blais

unread,
Jan 8, 2017, 11:37:07 PM1/8/17
to Beancount

--
You received this message because you are subscribed to the Google Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+unsubscribe@googlegroups.com.
To post to this group, send email to bean...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/34af184f-db4e-4978-8177-d4dc7f8636a6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

jfs...@gmail.com

unread,
Jan 9, 2017, 8:46:04 PM1/9/17
to Beancount
Wow!  Thanks Martin.  Hmm, it looks like I looked too deep.  I will try it out when I get back from vacation.

Jonathan.


On Sunday, January 8, 2017 at 11:37:07 PM UTC-5, Martin Blais wrote:
On Sun, Jan 8, 2017 at 9:09 PM, <jfs...@gmail.com> wrote:
When a csv file is extracted, the transactions are printed out with the oldest date first and the newest date last.  I was wondering if there is a way to reverse the sort order, i.e. print out the newest date first and the oldest date last, as this is how I prefer to have them ordered in my file.  

I looked in the code, and I thought the sort order might be set in ingest/importers/data.py by the function sorted(entries).  It seems to call the Python function sorted().  Sorted(entries) seems to be a function, so it cannot be overridden, so I tried changing the code and adding a True to the functin call to reverse it as an experiment (I realize any change I make to the code is not the best way, and will break on an update).  It didn't work though, the date order was still the same, so either I did not interpret things correctly or missed something.

Is there an easy way to reverse the sort order?  Apoligies if it is something I should have seen in the documentation or the Google Groups.

Jonathan

--
You received this message because you are subscribed to the Google Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages