Improvements for ordering in custom exports

http://manage.dimagi.com/default.asp?86347#695228
@agrzywinski I believe @dannyroberts question above was for you. Ball is in your court.